Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oG0BN-00047v-NL for pgsql-bugs@arkaria.postgresql.org; Mon, 25 Jul 2022 15:39:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oG0BL-0006e6-PJ for pgsql-bugs@arkaria.postgresql.org; Mon, 25 Jul 2022 15:39:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oG0BL-0006dw-Ga for pgsql-bugs@lists.postgresql.org; Mon, 25 Jul 2022 15:39:43 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oG0BJ-0004Uh-AF for pgsql-bugs@lists.postgresql.org; Mon, 25 Jul 2022 15:39:42 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 26PFdetb2023370; Mon, 25 Jul 2022 11:39:40 -0400 From: Tom Lane To: postgresql@middaysomewhere.com cc: Peter Eisentraut , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17558: 15beta2: Endless loop with UNIQUE NULLS NOT DISTINCT and INSERT ... ON CONFLICT In-reply-to: <17558-3f6599ffcf52fd4a@postgresql.org> References: <17558-3f6599ffcf52fd4a@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Mon, 25 Jul 2022 01:04:06 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2023368.1658763580.1@sss.pgh.pa.us> Date: Mon, 25 Jul 2022 11:39:40 -0400 Message-ID: <2023369.1658763580@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > In PostgreSQL 15 beta, when I try to insert a NULL value which violates a > "UNIQUE NULLS NOT DISTINCT" constraint, PostgreSQL will get stuck in an > endless loop if the command includes an "ON CONFLICT" clause. > CREATE TABLE test (val TEXT UNIQUE NULLS NOT DISTINCT); > INSERT INTO test (val) VALUES ('a') ON CONFLICT DO NOTHING; -- inserts 'a' > INSERT INTO test (val) VALUES ('a') ON CONFLICT DO NOTHING; -- does > nothing > INSERT INTO test (val) VALUES (NULL) ON CONFLICT DO NOTHING; -- inserts > NULL > INSERT INTO test (val) VALUES (NULL) ON CONFLICT DO NOTHING; -- > unresponsive Yup, still a problem in HEAD. It correctly reports an error if you just "INSERT INTO test (val) VALUES (NULL)", but something in the ON CONFLICT code path seems not to be on board with this. Peter? regards, tom lane