Re: Output clause for Upsert aka INSERT...ON CONFLICT

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Output clause for Upsert aka INSERT...ON CONFLICT
Дата
Msg-id CAKFQuwZTwQSkV543G4ZmNZUmeF_eNwqAkjWvm1U_wnviLsp0xA@mail.gmail.com
обсуждение исходный текст
Ответ на Output clause for Upsert aka INSERT...ON CONFLICT  (Anand Sowmithiran <anandsowmi2@gmail.com>)
Список pgsql-hackers
On Wednesday, January 26, 2022, Anand Sowmithiran <anandsowmi2@gmail.com> wrote:
The INSERT...ON CONFLICT is used for doing upserts in one of our app. 
Our app works with both MS SQL and Postgresql, based on customer needs.

Unlike the MS SQL MERGE command's OUTPUT clause that gives the $action [INSERT / UPDATE  /DELETE] that was done during the upsert, the RETURNING clause of the pgsql does not return the action done. 
We need this so that the application can use that for auditing and UI purposes.
 
Is there any workaround to get this info ?

There is not.  But I’d presume the correct trigger is fired for whichever DML is ultimately applied so maybe you have a way through that.
 
Or is there a way this enhancement can be requested in future PG versions ?


You just did.  There is nothing formal.  But presently there isn’t anyone championing improvements to this feature (just my unresearched impression, searching our public mailing lists and commitfest would let you form a researched impression).
 
David J.

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Is it correct to update db state in control file as "shutting down" during end-of-recovery checkpoint?
Следующее
От: vignesh C
Дата:
Сообщение: Re: Printing backtrace of postgres processes