Re: MERGE ... WHEN NOT MATCHED BY SOURCE
От | Alvaro Herrera |
---|---|
Тема | Re: MERGE ... WHEN NOT MATCHED BY SOURCE |
Дата | |
Msg-id | 20230321102849.ajmumhbngak3ltkw@alvherre.pgsql обсуждение исходный текст |
Ответ на | Re: MERGE ... WHEN NOT MATCHED BY SOURCE (Dean Rasheed <dean.a.rasheed@gmail.com>) |
Ответы |
Re: MERGE ... WHEN NOT MATCHED BY SOURCE
|
Список | pgsql-hackers |
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)
В списке pgsql-hackers по дате отправления: