pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: zhongxuchen@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16706: insert into on conflict(pk) do update error violates not-null constraint
Date: Mon, 09 Nov 2020 10:16:51 -0500
Message-ID: <1974489.1604935011@sss.pgh.pa.us> (raw)
In-Reply-To: <16706-08837c0cdaf4ce57@postgresql.org>
References: <16706-08837c0cdaf4ce57@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> example:
> CREATE TABLE TEST1 (
> 	id varchar(100) NOT NULL,
> 	name varchar(100) NOT NULL,
> 	status varchar(100) NOT NULL,
> 	CONSTRAINT test1_pkey PRIMARY KEY (id)
> )

> insert into TEST1 (ID, NAME,STATUS ) values('4','test','6') ;
> insert into TEST1 as t1 (ID, NAME,STATUS ) values('4',null,'6') on conflict
> (id) do update set NAME=COALESCE(excluded.NAME,t1.NAME),
> STATUS=COALESCE(excluded.STATUS,t1.STATUS);

I get

ERROR:  null value in column "name" violates not-null constraint
DETAIL:  Failing row contains (4, null, 6).

so this seems to have been fixed already.

			regards, tom lane





view thread (7+ messages)  latest in thread

Message-ID: <1974489.1604935011@sss.pgh.pa.us>
Permalink:  ../1974489.1604935011@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1974489.1604935011@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, zhongxuchen@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16706: insert into on conflict(pk) do update error violates not-null constraint
  In-Reply-To: <1974489.1604935011@sss.pgh.pa.us>

* 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