Re: Partial update on an postgres upsert violates constraint

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Kim Rose Carlsen <krc(at)hiper(dot)dk>, Andreas Terrius <gotenwinz99(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Partial update on an postgres upsert violates constraint
Date: 2016-11-19 20:57:19
Message-ID: 32134.1479589039@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> writes:
> ... So looks like constraints are checked before you get to the ON CONFLICT section.

Right. ON CONFLICT is a means for dealing with duplicate-key errors in
the specified (or inferred) unique index. It is *not* an all-purpose
error catcher. In the case at hand, the given INSERT request fails due
to not-null constraints that are unrelated to what the ON CONFLICT clause
tests for.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Janes 2016-11-19 21:12:58 Strict min and max aggregate functions
Previous Message Adrian Klaver 2016-11-19 20:48:27 Re: Partial update on an postgres upsert violates constraint