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

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Richard Guo <guofenglinux@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, postgresql@middaysomewhere.com, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2022-08-02T10:19:09Z
Lists: pgsql-bugs
On Tue, Jul 26, 2022 at 11:17:45AM +0800, Richard Guo wrote:
> Yeah, I can see the same problem. _bt_check_unique() can catch violation
> of unique index constraint successfully, so insert without 'ON CONFLICT'
> has no problem. But ExecCheckIndexConstraints() fails to tell the NULL
> tuple violates unique constraint, and the logic below is quite
> suspicious to me.

This is still an open item assigned to Peter, and beta3 is planned for
the 11th of August.  Would a resolution by the beginning of next week
be doable?
--
Michael

Commits

  1. Fix check_exclusion_or_unique_constraint for UNIQUE NULLS NOT DISTINCT.

  2. Add CHECK_FOR_INTERRUPTS in ExecInsert's speculative insertion loop.