Re: Conflict detection in ON CONFLICT

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: Conflict detection in ON CONFLICT
Дата
Msg-id CAMkU=1zPuOGoi4bk9gw=b2fc0CcC9SmKiXqrO5dRToW2A8OQpA@mail.gmail.com
обсуждение исходный текст
Ответ на Conflict detection in ON CONFLICT  (Nicolas ALBEZA <n.albeza@gmail.com>)
Список pgsql-general
On Wed, Jan 6, 2016 at 10:48 AM, Nicolas ALBEZA <n.albeza@gmail.com> wrote:
> Hello,
>
> Is there any way for a client to know if a conflict happened in an ON
> CONFLICT DO UPDATE query ?

Here is one way:

create table foo (x int primary key, y text);

insert into foo values (3,'insert') on conflict (x) do update set
y='update' returning y;

I don't know how to do it without leaving an extra column of cruft
behind in the table.

Cheers,

Jeff


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

Предыдущее
От: "balajishanmugam@live.in"
Дата:
Сообщение: Re: Postgresql 9.3 not coming up after restart in centos
Следующее
От: Ted Toth
Дата:
Сообщение: 9.5rc1 RLS select policy on insert?