Search Postgresql Archives

Re: Conflict detection in ON CONFLICT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 6, 2016 at 10:48 AM, Nicolas ALBEZA <n.albeza@xxxxxxxxx> 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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux