RI fast path gets cross-type foreign keys wrong

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Amit Langote <amitlangote09(at)gmail(dot)com>
Subject: RI fast path gets cross-type foreign keys wrong
Date: 2026-08-01 03:03:22
Message-ID: CAH2-WznQjX3GByh_Ju7unuzMcik_5PJ5D7i_=qhwk=gPEkhfVQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The attached isolation test patch (written by Claude code) shows that
the new RI fast path can get some things wrong when a foreign key uses
a cross-type equality operator.

The test has two permutations differing only in the primary key's type
-- date against a timestamp FK in the first, timestamp against
timestamp in the second. The interleaving is identical and the
referenced key is present throughout, so both should behave the same
way. The second succeeds (which is correct), while the first fails
with a foreign key violation (which is incorrect).

The fast path was introduced by b7b27eb41. This is an issue on 19 and
master only.

--
Peter Geoghegan

Attachment Content-Type Size
0001-Add-isolation-test-for-the-RI-fast-path-s-cross-type.patch application/octet-stream 6.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2026-08-01 03:19:46 Re: RI fast path gets cross-type foreign keys wrong
Previous Message Japin Li 2026-08-01 01:44:02 Re: WAL compression setting after PostgreSQL LZ4 default change