Re: BUG #17558: 15beta2: Endless loop with UNIQUE NULLS NOT DISTINCT and INSERT ... ON CONFLICT
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: postgresql@middaysomewhere.com
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>,
pgsql-bugs@lists.postgresql.org
Date: 2022-07-25T15:39:40Z
Lists: pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> 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
Commits
-
Fix check_exclusion_or_unique_constraint for UNIQUE NULLS NOT DISTINCT.
- d59383924c58 16.0 landed
- 3419d51e1957 15.0 landed
-
Add CHECK_FOR_INTERRUPTS in ExecInsert's speculative insertion loop.
- efba7a63ffbe 14.5 landed
- 963a6b6fa45d 12.12 landed
- 6ad86feecb24 16.0 landed
- 4c7b16312ea3 15.0 landed
- 2e2f3435af8b 11.17 landed
- 23edf0e8b4d1 13.8 landed
- 138213684ad4 10.22 landed