| From: | Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> |
|---|---|
| To: | shihao zhong <zhong950419(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Aleksander Alekseev <aleksander(at)tigerdata(dot)com> |
| Subject: | Re: Prevent foreign key references to unlogged partitions |
| Date: | 2026-11-15 07:34:48 |
| Message-ID: | CAN4CZFPLeGU3hy5VJ7m8p15fbUzFivPeb3AZhTAiA3dYsZc1vg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Thanks for the review!
> 1. For 003, a SET LOGGED that fails the foreign key check rewrites
> the table first. I think it will create too much overhead.
Good catch, I only thought about the cases that should fail and I
didn't notice the WAL overhead.
v4 checks the foreign keys at the start of phase 3 too, before any
rewrite. Phase 2 already added the keys of the same command at that
point, so this also covers SET LOGGED, ADD FOREIGN KEY. The check at
the end remains for event
triggers and USING expressions, we need both.
There's also a new regression test which verifies that no
table_rewrite event fires in this case. I am not sure if we want to
keep that, but for the review now I think it's better to have more
tests than less.
> 2. For 004, this seems already captured in a different bug[1], I think the
> current patch is to reject access to the table from the trigger.
>
> If that goes in, would 0004 still be needed?
No, if that gets committed, we don't need 0004. For now I kept it
here, but if that gets committed, I'll drop it, and also the previous
patches can be committed without it.
| Attachment | Content-Type | Size |
|---|---|---|
| nocfbot-v4-REL_17-0001-Check-partition-persistence-on-both-sides-of-fore.patch | text/x-patch | 18.6 KB |
| nocfbot-v4-REL_17-0002-Check-foreign-keys-after-adding-them-in-ALTER-TAB.patch | text/x-patch | 18.3 KB |
| nocfbot-v4-REL_17-0003-Don-t-undo-table_rewrite-event-trigger-changes-in.patch | text/x-patch | 5.2 KB |
| v4-0001-pgbench-don-t-disable-unlogged-tables-when-partit.patch | text/x-patch | 3.1 KB |
| v4-0002-Disallow-foreign-keys-referencing-unlogged-partit.patch | text/x-patch | 8.3 KB |
| v4-0003-Check-foreign-keys-after-adding-them-in-ALTER-TAB.patch | text/x-patch | 18.0 KB |
| v4-0004-Don-t-undo-table_rewrite-event-trigger-changes-in.patch | text/x-patch | 5.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Joao Rito | 2026-11-15 08:26:41 | Re: XMLConcat() and XMLRoot() silently drop xml values with an invalid declaration |
| Previous Message | Michael Paquier | 2026-11-15 06:18:02 | Re: Index drops during phase 1 of REINDEX CONCURRENTLY |