-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix insert with nested returning clause fails alongside text[] column (fix #3148 & #2520) #3198
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 insert with nested returning clause fails alongside text[] column (fix #3148 & #2520) #3198
Conversation
|
Deploy preview for hasura-docs ready! Built with commit a21d504 |
|
Review app for commit 977969d deployed to Heroku: https://hge-ci-pull-3198.herokuapp.com |
b0df70d to
ad8b807
Compare
|
Review app for commit ad8b807 deployed to Heroku: https://hge-ci-pull-3198.herokuapp.com |
|
Review app for commit 7896326 deployed to Heroku: https://hge-ci-pull-3198.herokuapp.com |
lexi-lambda
left a comment
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.
LGTM apart from two tiny comments.
|
Review app for commit 6c9633c deployed to Heroku: https://hge-ci-pull-3198.herokuapp.com |
|
Review app for commit b423249 deployed to Heroku: https://hge-ci-pull-3198.herokuapp.com |
|
Review app for commit a21d504 deployed to Heroku: https://hge-ci-pull-3198.herokuapp.com |
|
Review app https://hge-ci-pull-3198.herokuapp.com is deleted |
Description
If a table has a column with the array type then insert mutation to that table with returning its relationships throws an unexpected error.
As given in #3148:
For the following mutation:
Gives the following unexpected error:
{ "errors": [ { "extensions": { "path": "$.selectionSet.insert_site.args.objects", "code": "parse-failed" }, "message": "A string is expected for type : _text" } ] }When relationship fields are found in
returningfields, the server performs the mutation in two steps:returningfields.Refer to commits 5f274b5 and 5bafdce to learn more about the above steps.
In step 2, parsing the array column values fails since our parser expects
Stringrepresentation of Postgres arrays. There are two ways to solve this problemAffected components
Related Issues
Fix #3148 & #2520
Solution and Design
As mentioned in the above description, the mutated column values are returned as text.
Steps to test and verify
Follow the reproduction guide given in #3148 or #2520 and error shouldn't happen.
Limitations, known bugs & workarounds