-
-
Notifications
You must be signed in to change notification settings - Fork 569
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
fix(postgres): cast list of enums to their correct type (#417) #463
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @danielbuechele, this is a much requested feature!
I'm not confident in the sql.raw
with the notNullType.name
; can we use sql.identifier
here instead? Something like
const listTypeCast = sql.query(`::${sql.identifier(nonNullType instanceof PgEnumType ? nonNullType.name : 'text')}[]`)
I'm not sure if that will work?
Now using |
This looks great @danielbuechele! Are you able to add any tests for it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not comfortable merging this until there are some tests in place (because I don't understand enough of PostGraphQL to be certain this won't cause any issues).
Added test for the function I modified |
@benjie @danielbuechele What is the status of this? Looks like it's just blocked by some tests. I can add these if that'd be helpful. |
@danscan I think we just need CI to pass before we can merge. |
It seems to just be lint issues that need resolving. |
I'll fix them tomorrow! (and get my linter working) |
Huh, linter is now passing, but a lot of other test failing. I don't really know where this is coming from. |
The errors centre around:
Here's the relevant definitions: Seems the integer array is being interpreted as a text array instead. |
This adds an explicit type cast to enum arrays
Fixes #417