From: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Avoid bogus scans of partitions when marking FKs enforced |
Date: | 2025-06-05 16:39:32 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Avoid bogus scans of partitions when marking FKs enforced
Similar to commit cc733ed164c5: when an unenforced foreign key that
references a partitioned table is altered to be enforced, we scan
the constrained table based on each partition on the referenced
partitioned table. This is bogus and likely to cause the ALTER TABLE to
fail: we must only scan the constrained table as pointing to the
top-level partitioned table. Oversight in commit eec0040c4bcd. Fix by
eliding those scans.
Author: Amul Sul <sulamul(at)gmail(dot)com>
Reported-by: jian he <jian(dot)universality(at)gmail(dot)com>
Discussion: https://postgr.es/m/CACJufxF1e_gPOLtsDoaE4VCgQPC8KZW_kPAjPR5Rvv4Ew=fb2A@mail.gmail.com
Branch
------
master
Modified Files
--------------
src/backend/commands/tablecmds.c | 7 ++++--
src/test/regress/expected/foreign_key.out | 41 +++++++++++++++++++------------
src/test/regress/sql/foreign_key.sql | 11 ++++++---
3 files changed, 37 insertions(+), 22 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2025-06-05 18:51:02 | pgsql: nbtree: Remove useless row compare arg. |
Previous Message | Tom Lane | 2025-06-05 15:30:30 | pgsql: Doc: you must own the target object to use SECURITY LABEL. |