Re: PG19: two RI fast-path issues found while testing the batching revert

From: Nikolay Samokhvalov <nik(at)postgres(dot)ai>
To: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Amit Langote <amitlangote09(at)gmail(dot)com>
Subject: Re: PG19: two RI fast-path issues found while testing the batching revert
Date: 2026-09-15 02:13:54
Message-ID: CAM527d9PzFzagr67N0=Ex2ng1p5HzrcAszy3j5OoZKHXQMARXA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 11, 2026 at 2:25 AM Amit Langote
<amitlangote09(at)gmail(dot)com> wrote:
> For 0001, SPI's FOR KEY SHARE also requires UPDATE privilege on at
> least one column. I've used ExecCheckOneRelPerms() to cover that along
> with column-level SELECT. The tests exercise both per-row and batched
> checks, including rejection without UPDATE and acceptance with UPDATE
> on an unrelated column.

I kept testing with my AI harness and found another case on master and
PG19. Replacing a loose cross-type equality member leaves the FK's stored
operator unchanged. An uncached fast-path check then errors; warmed
metadata is not invalidated by the pg_amop change. The replacement calls
the same int48eq function, so the family semantics are unchanged and SPI
continues to enforce the FK normally.

Attached are standalone fixes for master a625fc57 and PG19 f4b511ae.
They invalidate the metadata on pg_amop changes and use SPI unless the
stored operator is still an equality member. On master, buffered rows
also need the SPI fallback if the family changes between AFTER triggers.

Both assertion builds pass the native foreign_key test, full regression
and isolation suites, and the injection-point suites. The tests cover
warmed and uncached metadata and missing keys on both sides of the DDL.

Thanks,
Nik

Attachment Content-Type Size
master-v1-0001-Check-RI-fast-path-operator-family-membership.patch application/x-patch 23.2 KB
REL_19_STABLE-v1-0001-Check-RI-fast-path-operator-family-membership.patch application/x-patch 13.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message ZizhuanLiu X-MAN 2026-09-15 02:18:06 Optimize MCV stats for sortable types and utilize sorted-order properties
Previous Message Nikolay Samokhvalov 2026-09-15 02:12:30 [PATCH] Invalidate cached plans when casts change