Add postgres support for specifying schema when defining enum type #2183
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello!
Since we also ran into the need for specifying the schema name when defining a postgres enum to avoid collision when the enum types name appears in multiple schemas (#1171), here is an attempt to implement this feature.
This PR contains the following changes:
schema
attributeschema.enum_name
when schema is specifiedpg_catalog
, the schema's name + the count of type that have the same name as the type that is being queried are joined to the fetched data. In case there are multiple types with the same name, use theschema.enum_name
format (unless the schema is the defaultpublic
schema, in that case we just use the enum name)schema
attribute is provided, include it in the fetch query so that only the desired type gets returned.color_upper
but in a different schematest
which verified that there is no collision with these 2 enumsThis is a quite minimalistic implementation, therefore it's possible that some things are missing (some edge cases that need to be covered/tested, better code design, ...), if so, let me know and I'll be happy to add the requested changes.