Re: MERGE ... RETURNING

Поиск
Список
Период
Сортировка
От Dean Rasheed
Тема Re: MERGE ... RETURNING
Дата
Msg-id CAEZATCUHtYtBX5wVB4h8+06nMcTJat2DVhScG4EUHiTFRH7E+Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: MERGE ... RETURNING  (Jeff Davis <pgsql@j-davis.com>)
Ответы Re: MERGE ... RETURNING  (Jeff Davis <pgsql@j-davis.com>)
Список pgsql-hackers
On Thu, 13 Jul 2023 at 17:01, Jeff Davis <pgsql@j-davis.com> wrote:
>
> MERGE can end up combining old and new values in a way that doesn't
> happen with INSERT/UPDATE/DELETE. For instance, a "MERGE ... RETURNING
> id" would return a mix of NEW.id (for INSERT/UPDATE actions) and OLD.id
> (for DELETE actions).
>

Right, but allowing OLD/NEW.colname in the RETURNING list would remove
that complication, and it shouldn't change how a bare colname
reference behaves.

> The pg_merge_action() can differentiate the old and new values, but
> it's a bit more awkward.
>

For some use cases, I can imagine allowing OLD/NEW.colname would mean
you wouldn't need pg_merge_action() (if the column was NOT NULL), so I
think the features should work well together.

Regards,
Dean



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: remaining sql/json patches
Следующее
От: Dean Rasheed
Дата:
Сообщение: Re: MERGE ... RETURNING