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  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: "shiy.fnst@fujitsu.com"
Дата:
Сообщение: RE: Dropped and generated columns might cause wrong data on subs when REPLICA IDENTITY FULL
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: Initial Schema Sync for Logical Replication