-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix postgres query error when computed fields included in mutation response (fix #4035) #4080
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 query error when computed fields included in mutation response (fix #4035) #4080
Conversation
Resolve Conflicts: CHANGELOG.md
|
Review app for commit bb2b631 deployed to Heroku: https://hge-ci-pull-4080.herokuapp.com |
|
Changelog is fine. |
|
Deploy preview for hasura-docs ready! Built with commit 8c2b5ad |
|
Review app for commit 8da7578 deployed to Heroku: https://hge-ci-pull-4080.herokuapp.com |
8da7578 to
8c2b5ad
Compare
|
Review app for commit 8c2b5ad deployed to Heroku: https://hge-ci-pull-4080.herokuapp.com |
Resolve Conflicts: CHANGELOG.md
|
Review app for commit 889f375 deployed to Heroku: https://hge-ci-pull-4080.herokuapp.com |
|
Review app for commit 1142689 deployed to Heroku: https://hge-ci-pull-4080.herokuapp.com |
|
Review app https://hge-ci-pull-4080.herokuapp.com is deleted |
Description
The re-modeled check permissions for insert and update (see #3804, #3598) generates the INSERT and UPDATE SQL CTE statement by
RETURNING *and an extra column which invokes the check permission exception on invalidation (see note[Mutation output expression]in the diff) . This causes the output rows from the mutation CTE to contain an extra column and cannot typecast to table row type for the computed field function's input. Hence the Postgres query is failing. This PR fixes the same.Changelog
CHANGELOG.mdis updated with user-facing content relevant to this PR.Affected components
Related Issues
Fix #4035
Solution and Design
In the SQL statement which generates the mutation output, add a CTE which extracts only table columns in the order of their ordinal positions. This will ensure the input for computed field will be cast-able to table rowtype. See note
[Mutation output expression]inHasura.RQL.DML.Returningmodule.Steps to test and verify
Reproduce the issue #4035, 'postgres query error' shouldn't happen.
Limitations, known bugs & workarounds
Server checklist
Catalog upgrade
Does this PR change Hasura Catalog version?
Metadata
Does this PR add a new Metadata feature?
GraphQL
Breaking changes