public inbox for [email protected]
help / color / mirror / Atom feedFrom: Alvaro Herrera <[email protected]>
To: Dean Rasheed <[email protected]>
Cc: Vik Fearing <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: MERGE ... WHEN NOT MATCHED BY SOURCE
Date: Tue, 21 Mar 2023 11:28:49 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAEZATCUtOCBPp4LB6M-0zv_FkqoZmKC=foADq1xG5ByyuRko9g@mail.gmail.com>
On 2023-Mar-19, Dean Rasheed wrote:
> diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
> new file mode 100644
> index efe88cc..e1ebc8d
> --- a/src/backend/parser/gram.y
> +++ b/src/backend/parser/gram.y
> +merge_when_tgt_matched:
> + WHEN MATCHED { $$ = MERGE_WHEN_MATCHED; }
> + | WHEN NOT MATCHED BY SOURCE { $$ = MERGE_WHEN_NOT_MATCHED_BY_SOURCE; }
> + ;
I think a one-line comment on why this "matched" production matches "NOT
MATCHED BY" would be useful. I think you have a big one in
transformMergeStmt already.
> + /* Combine it with the action's WHEN condition */
> + if (action->qual == NULL)
> + action->qual = (Node *) ntest;
> + else
> + action->qual =
> + (Node *) makeBoolExpr(AND_EXPR,
> + list_make2(ntest, action->qual),
> + -1);
Hmm, I think ->qual is already in implicit-and form, so do you really
need to makeBoolExpr, or would it be sufficient to append this new
condition to the list?
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"El miedo atento y previsor es la madre de la seguridad" (E. Burke)
view thread (3+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: MERGE ... WHEN NOT MATCHED BY SOURCE
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox