-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix non-admin insert returns null column values when query affects zero rows in postgres (fix #563) #565
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
Conversation
|
Review app available at: https://hge-ci-pull-565.herokuapp.com |
server/src-rsr/insert_trigger.sql.j2
Outdated
| VALUES (NEW.*) ; IF FOUND THEN RETURN NEW; ELSE RETURN null; END IF; | ||
| ELSE | ||
| action = conflict_clause ->> 'action'; | ||
| constraint_name = conflict_clause ->> 'constraint'; |
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.
constraint_name = quote_ident(conflict_clause ->> 'constraint');
server/src-rsr/insert_trigger.sql.j2
Outdated
| IF action is NOT NULL THEN | ||
| CASE | ||
| WHEN action = 'ignore'::text AND constraint_name IS NULL THEN | ||
| INSERT INTO {{table_name}} VALUES (NEW.*) ON CONFLICT DO NOTHING; IF FOUND THEN RETURN NEW; ELSE RETURN null; END IF; |
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.
Why not add IF FOUND THEN RETURN NEW; ELSE RETURN null; END IF; before the end of the case statement?
|
Review app available at: https://hge-ci-pull-565.herokuapp.com |
|
Review app https://hge-ci-pull-565.herokuapp.com is deleted |
## Description Fixes https://hasurahq.atlassian.net/browse/V3ENGINE-134 The problem is caused by a local relationship with multiple remote joins inside. The `not_nested` case passes, but `nested` and `very_nested` fail. The root cause of the problem was wrong assumption in the collecting of join arguments code. This PR fixes it, and also refactors the remote joins execution code to make it easier (hopefully) to follow . --------- Co-authored-by: Anon Ray <rayanon004@gmail.com> Co-authored-by: Anon Ray <ecthiender@users.noreply.github.com> V3_GIT_ORIGIN_REV_ID: 52f5449261406da51a3a6ea7d96d1b166220e8fe
Description
Insert trigger function: If query affects no rows then return
nullWhat component does this PR affect?
Requires changes from other components? If yes, please mark the components:
Related Issue
Fix #563
Solution and Design
Insert trigger function is modified to have
IF r IS NULL THEN RETURN null; ELSE RETURN r; END IF;in return statement.Type
Checklist: