pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Torsten Förtsch <tfoertsch123@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: multiple conflict targets
Date: Fri, 10 Aug 2018 06:28:30 -0700
Message-ID: <5894f679-804e-379d-cc49-03936f54af9e@aklaver.com> (raw)
In-Reply-To: <CAKkG4_m_EMZ5Rbfk8CY5P5JdGoupRVWh2STXE=dU+Lqs=E3uqw@mail.gmail.com>
References: <CAKkG4_m_EMZ5Rbfk8CY5P5JdGoupRVWh2STXE=dU+Lqs=E3uqw@mail.gmail.com>

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
adrian.klaver@aklaver.com




view thread (2+ messages)

Message-ID: <5894f679-804e-379d-cc49-03936f54af9e@aklaver.com>
Permalink:  ../5894f679-804e-379d-cc49-03936f54af9e@aklaver.com/
Also on:    postgresql.org/message-id/5894f679-804e-379d-cc49-03936f54af9e@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, tfoertsch123@gmail.com
  Subject: Re: multiple conflict targets
  In-Reply-To: <5894f679-804e-379d-cc49-03936f54af9e@aklaver.com>
  References: <CAKkG4_m_EMZ5Rbfk8CY5P5JdGoupRVWh2STXE=dU+Lqs=E3uqw@mail.gmail.com> <5894f679-804e-379d-cc49-03936f54af9e@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox