Re: ORCE ROW LEVEL SECURITY makes ADD/VALIDATE FOREIGN KEY skip rows hidden from the owner (RI_Initial_Check)

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: Ludwig Kannicht <info(at)luline(dot)de>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: ORCE ROW LEVEL SECURITY makes ADD/VALIDATE FOREIGN KEY skip rows hidden from the owner (RI_Initial_Check)
Date: 2026-11-03 03:49:43
Message-ID: CAGRkXqQDMpjNb2OXrAgn7eKCPwzHT=k3xZWjjw_xHaX3z0e-Cw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Ludwig,

Thanks for the report. I can reproduce it on master and 14.

088c83363a1 made the foreign key triggers ignore FORCE ROW LEVEL
SECURITY, so the owner's policies cannot hide rows from them. But it
missed the check that ADD FOREIGN KEY and VALIDATE CONSTRAINT run on
existing rows. The check in DETACH PARTITION has the same gap.

The attached patch sets the flag in both places, which is your second
suggestion.

Thanks,
Shihao

Attachment Content-Type Size
v1-0001-Ignore-FORCE-ROW-LEVEL-SECURITY-in-initial-foreign-k.patch application/octet-stream 2.9 KB
v1-0002-Test-foreign-key-checks-under-FORCE-ROW-LEVEL-SECURI.patch application/octet-stream 3.5 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Venu K 2026-11-03 05:23:49 Re: BUG #19826: corr()/regr_r2() of constant input: NULL serially, 1 with partial aggregation
Previous Message shihao zhong 2026-11-03 03:40:47 Re: [Bug] Heap use-after-free in COPY FROM error context after ON_ERROR ignore skips a row