Re: MERGE ... RETURNING

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: MERGE ... RETURNING
Дата
Msg-id d200e6b4cf17f19d804b79d02d80567cb9889c00.camel@j-davis.com
обсуждение исходный текст
Ответ на Re: MERGE ... RETURNING  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Ответы Re: MERGE ... RETURNING  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Список pgsql-hackers
On Thu, 2023-07-13 at 18:01 +0100, Dean Rasheed wrote:
> 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.

For use cases where a user could do it either way, which would you
expect to be the "typical" way (assuming we supported the new/old)?

  MERGE ... RETURNING pg_merge_action(), id, val;

or

  MERGE ... RETURNING id, OLD.val, NEW.val;

?

I am still bothered that pg_merge_action() is so context-sensitive.
"SELECT pg_merge_action()" by itself doesn't make any sense, but it's
allowed in the v8 patch. We could make that a runtime error, which
would be better, but it feels like it's structurally wrong. This is not
an objection, but it's just making me think harder about alternatives.

Maybe instead of a function it could be a special table reference like:

  MERGE ... RETURNING MERGE.action, MERGE.action_number, id, val?

Regards,
    Jeff Davis




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

Предыдущее
От: Farias de Oliveira
Дата:
Сообщение: In Postgres 16 BETA, should the ParseNamespaceItem have the same index as it's RangeTableEntry?
Следующее
От: Gurjeet Singh
Дата:
Сообщение: Re: Fix search_path for all maintenance commands