Re: Routed ON CONFLICT inserts broken by partition-local deferrable unique constraints in 19 and master

From: Mihail Nikalayeu <mihailnikalayeu(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Routed ON CONFLICT inserts broken by partition-local deferrable unique constraints in 19 and master
Date: 2026-09-01 09:15:09
Message-ID: CADzfLwVjwqca1Ot2saJ0XmcUQpCCiq4cLDnrtWmK0BHqOd_Mjw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!

> 2bc7e886fc1 and the commit that has triggered this thread both refer
> to the same set of improvements regarding the interactions of rebuilt
> indexes and ON CONFLICT, so my take is that if we finish by updating
> the same area of the code we could just group both changes together,
> but I agree that my line of thoughts may be thin. It seems to me that
> we'd better look first at this secondary issue before drawing a
> conclusion regarding if both issues should be handled together or
> separately.

This is a "grouped" version. Also, it handles possible collation
issues + provides a set of tests to pin the correct behaviour.

I haven't reviewed the tests too deeply (AI-generated) but they pass
on 18 (expect DO SELECT cases) and on the fixed version, failing on
the pre-fix.

Super-short version:
* move IsIndexCompatibleAsArbiter to index.c with a slight signature change
* handle `indimmediate` in it
* use `equal` for lists instead of list_difference
* use IsIndexCompatibleAsArbiter for both - partitioned and named
constraint cases
* simply infer_arbiter_indexes a bit (reverting part of 2bc7e886fc1b)

Best regards,
Mikhail.

Attachment Content-Type Size
v2-0001-Require-exact-equivalence-for-additional-ON-CONFL.patch application/octet-stream 28.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrei Lepikhov 2026-09-01 09:16:54 Re: Do not scan index in right table if condition for left join evaluates to false using columns in left table
Previous Message Bertrand Drouvot 2026-09-01 09:07:25 Re: Introduce XID age based replication slot invalidation