Re: Upsert with a partial unique index constraint violation - Mailing list pgsql-general

From Peter Geoghegan
Subject Re: Upsert with a partial unique index constraint violation
Date
Msg-id CAH2-Wzn_=rKu4Hhf-j85qZAajmmqtZ41abKugwqKTygj6Rn-UA@mail.gmail.com
Whole thread Raw
In response to Upsert with a partial unique index constraint violation  (Tim Dawborn <tim.dawborn@gmail.com>)
Responses Re: Upsert with a partial unique index constraint violation  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Upsert with a partial unique index constraint violation  (Tim Dawborn <tim.dawborn@gmail.com>)
List pgsql-general
On Mon, Jul 11, 2016 at 12:06 AM, Tim Dawborn <tim.dawborn@gmail.com> wrote:
> tmp=# INSERT INTO foo (a, b, c, d) VALUES (1, 2, 'four', true)
> tmp-# ON CONFLICT (a, b) WHERE d = true
> tmp-# DO UPDATE SET c = 'four' WHERE foo.a = 1 AND foo.b = 2 AND foo.d =
> true;
> ERROR:  there is no unique or exclusion constraint matching the ON CONFLICT
> specification
>
> If anyone knows what I'm doing wrong and how to get this to work, or knows
> that this is not possible to achieve, I'm all ears.

That should work. Are you sure you haven't spelled it "... WHERE d IS TRUE"?

--
Peter Geoghegan


pgsql-general by date:

Previous
From: Tim Dawborn
Date:
Subject: Upsert with a partial unique index constraint violation
Next
From: Nikhil
Date:
Subject: BDR - Ignore already exists error during DDL replay