BUG #17558: 15beta2: Endless loop with UNIQUE NULLS NOT DISTINCT and INSERT ... ON CONFLICT

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: postgresql(at)middaysomewhere(dot)com
Subject: BUG #17558: 15beta2: Endless loop with UNIQUE NULLS NOT DISTINCT and INSERT ... ON CONFLICT
Date: 2022-07-25 01:04:06
Message-ID: 17558-3f6599ffcf52fd4a@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 17558
Logged by: Andrew Kesper
Email address: postgresql(at)middaysomewhere(dot)com
PostgreSQL version: Unsupported/Unknown
Operating system: Debian 11 (buster)
Description:

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

PostgreSQL will max out the CPU, complain that the WAL is growing too fast,
consume all available disk space, then crash.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kyotaro Horiguchi 2022-07-25 02:36:08 Re: BUG #17556: ts_headline does not correctly find matches when separated by 4,999 words
Previous Message Ajin Cherian 2022-07-24 08:16:42 Re: Excessive number of replication slots for 12->14 logical replication