On Mon, 31 Aug 2026, Mihail Nikalayeu <[email protected]> wrote: > What I understood - the issue is a little bit wider, it also may > appear on a named constraint - there it is not checked for both > `deferrable` and `nulls not distinct` to be matching original index > itself.
I didn't add tests about this in the patch, but it should also handle these partition-local cases, e.g. CREATE TABLE d (a int, b text, CONSTRAINT d_pk PRIMARY KEY (a)) PARTITION BY RANGE (a); CREATE TABLE d1 PARTITION OF d FOR VALUES FROM (0) TO (100); ALTER TABLE d1 ADD CONSTRAINT d1_a_def UNIQUE (a) DEFERRABLE; INSERT INTO d VALUES (1, 'one'); INSERT INTO d VALUES (2, 'two') ON CONFLICT ON CONSTRAINT d_pk DO UPDATE SET b = EXCLUDED.b; -- master: ERROR; patched: INSERT 0 1 Also, now that I took another look into this, a somewhat similar PG19 regression exists outside partitions tables, caused by a different commit (2bc7e886fc1): CREATE TABLE t (a int, b text, CONSTRAINT t_u UNIQUE (a)); ALTER TABLE t ADD CONSTRAINT t_nnd UNIQUE NULLS NOT DISTINCT (a); INSERT INTO t VALUES (NULL, 'one'); INSERT INTO t VALUES (NULL, 'two') ON CONFLICT ON CONSTRAINT t_u DO UPDATE SET b = 'upd'; -- 18: ERROR: duplicate key value violates unique constraint "t_nnd" -- (named arbiter t_u sees no conflict on NULLs, insert proceeds, t_nnd rejects) -- 19: INSERT 0 1 -> table now (NULL, 'upd') -- (t_nnd silently used as arbiter user never named; error swallowed, row updated) But that seems like a different issue requiring a different fix.
