multiple conflict targets

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

multiple conflict targets

Torsten Förtsch-2
Hi,

if I read https://www.postgresql.org/docs/9.6/static/sql-insert.html correctly there can be only one conflict target or none at all.

What if I have a table with 3 unique constraints? If the first one is violated by the insert I want to do nothing. If the 2nd is violated some fields should be updated. And violation of the 3rd one should raise an error.

Can that be expressed?

Thanks,
Torsten
Reply | Threaded
Open this post in threaded view
|

Re: multiple conflict targets

Adrian Klaver-4
On 08/10/2018 03:12 AM, Torsten Förtsch wrote:

> Hi,
>
> if I read https://www.postgresql.org/docs/9.6/static/sql-insert.html 
> correctly there can be only one conflict target or none at all.
>
> What if I have a table with 3 unique constraints? If the first one is
> violated by the insert I want to do nothing. If the 2nd is violated some
> fields should be updated. And violation of the 3rd one should raise an
> error.
>
> Can that be expressed?

Yes as a trigger and associated function.

>
> Thanks,
> Torsten


--
Adrian Klaver
[hidden email]

Previous Thread Next Thread