Re: BUG #13886: When INSERT ON CONFLICT DO UPDATE updates, it returns INSERT rather than UPDATE

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: BUG #13886: When INSERT ON CONFLICT DO UPDATE updates, it returns INSERT rather than UPDATE
Дата
Msg-id CAM3SWZT3X4zsKQwoAfe59afay+MWLLpQXtMDOVchBJfv+iqrNg@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #13886: When INSERT ON CONFLICT DO UPDATE updates, it returns INSERT rather than UPDATE  (rwestlun@gmail.com)
Список pgsql-bugs
On Sun, Jan 24, 2016 at 11:48 PM,  <rwestlun@gmail.com> wrote:
> I believe postgres should be returning "UPDATE" here instead of "INSERT"
> because I see no way to know which operation took place.  I believe my only
> options at the moment are using a second query or adding a column like
> "just_created BOOLEAN DEFAULT true", setting it to false in the UPDATE
> clause, and returning it.

This is the documented behavior for the command tag. I don't think
that it's workable to expose more information there.

It might be desirable to have a feature that exposed whether an insert
or update occurred in respect of each row projected by RETURNING,
perhaps by using a special expression (you might be able to do
something kludgey with xmax today, but I don't want to recommend that,
even informally).

This is a feature request, not a bug. Please post feature requests to
the -general list.

--
Peter Geoghegan

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

Предыдущее
От: Gavin Flower
Дата:
Сообщение: Re: BUG #13883: Very Important Facility
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: BUG #13886: When INSERT ON CONFLICT DO UPDATE updates, it returns INSERT rather than UPDATE