这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@rakeshkky
Copy link
Member

@rakeshkky rakeshkky commented Sep 28, 2018

Description

Insert trigger function: If query affects no rows then return null

What component does this PR affect?

  • Server
  • Console
  • CLI
  • Docs
  • Community Content
  • Build System

Requires changes from other components? If yes, please mark the components:

  • Server
  • Console
  • CLI
  • Docs
  • Community Content
  • Build System

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Docs update
  • Community content

Checklist:

  • I have read the contributing guide and my code conforms to the guidelines.
  • This change requires a change in the documentation.
  • I have updated the documentation accordingly.
  • I have modified required tests.

@rakeshkky rakeshkky added s/ok-to-merge Status: This pull request can be merged to master c/server Related to server e/quickfix can be wrapped up in few hours labels Sep 28, 2018
@rakeshkky rakeshkky self-assigned this Sep 28, 2018
@rakeshkky rakeshkky requested a review from 0x777 September 28, 2018 09:52
@hasura-bot
Copy link
Contributor

Review app available at: https://hge-ci-pull-565.herokuapp.com

VALUES (NEW.*) ; IF FOUND THEN RETURN NEW; ELSE RETURN null; END IF;
ELSE
action = conflict_clause ->> 'action';
constraint_name = conflict_clause ->> 'constraint';
Copy link
Member

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');

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;
Copy link
Member

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?

@hasura-bot
Copy link
Contributor

Review app available at: https://hge-ci-pull-565.herokuapp.com

@shahidhk shahidhk merged commit fc7ea92 into hasura:master Sep 29, 2018
@hasura-bot
Copy link
Contributor

Review app https://hge-ci-pull-565.herokuapp.com is deleted

@cloudflare-workers-and-pages
Copy link

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 746cae5
Status:🚫  Build failed.

View logs

hasura-bot pushed a commit that referenced this pull request May 14, 2024
## 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c/server Related to server e/quickfix can be wrapped up in few hours s/ok-to-merge Status: This pull request can be merged to master

Projects

None yet

Development

Successfully merging this pull request may close these issues.

non-admin upsert returns null column values when query affects no rows in postgres

4 participants