Skip to content

Support enum types #387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 26, 2024
Merged

Support enum types #387

merged 2 commits into from
Mar 26, 2024

Conversation

plcplc
Copy link
Contributor

@plcplc plcplc commented Mar 25, 2024

What

This PR improves introspection support for enum types.

Comparison operators and aggregation functions on enum types are implicitly defined in PostgreSQL and thus were not detected prior to this PR.

How

We simply collect which enum types are defined and make up the conventional comparison operators and the min/max aggregation functions for all enum types.

We test that we can select and aggregate enum types, and that we can insert enum values which PostgreSQL validates.

We also collect the enum value labels, which we will be using once ndc-spec v0.1.1 is released.

@plcplc plcplc requested a review from soupi March 25, 2024 16:20
@plcplc plcplc enabled auto-merge March 25, 2024 16:20
@plcplc plcplc removed the request for review from soupi March 25, 2024 16:23
{
"message": "Unprocessable content",
"details": {
"detail": "error returned from database: invalid input value for enum card_suit: \"horses\""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐴

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐣

Copy link
Contributor

@danieljharvey danieljharvey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely great.

@plcplc plcplc added this pull request to the merge queue Mar 26, 2024
Merged via the queue into main with commit eae20af Mar 26, 2024
35 checks passed
@plcplc plcplc deleted the plc/issues/PG-63 branch March 26, 2024 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants