pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix FK triggers losing DEFERRABLE/INITIALLY DEFERRED when marked 2+ messages / 1 participants [nested] [flat]
* pgsql: Fix FK triggers losing DEFERRABLE/INITIALLY DEFERRED when marked @ 2026-03-30 05:39 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Fujii Masao @ 2026-03-30 05:39 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix FK triggers losing DEFERRABLE/INITIALLY DEFERRED when marked ENFORCED again Previously, a foreign key defined as DEFERRABLE INITIALLY DEFERRED could behave as NOT DEFERRABLE after being set to NOT ENFORCED and then back to ENFORCED. This happened because recreating the FK triggers on re-enabling the constraint forgot to restore the tgdeferrable and tginitdeferred fields in pg_trigger. Fix this bug by properly setting those fields when the foreign key constraint is marked ENFORCED again and its triggers are recreated, so the original DEFERRABLE and INITIALLY DEFERRED properties are preserved. Backpatch to v18, where NOT ENFORCED foreign keys were introduced. Author: Yasuo Honda <yasuo.honda@gmail.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/CAKmOUTms2nkxEZDdcrsjq5P3b2L_PR266Hv8kW5pANwmVaRJJQ@mail.gmail.com Backpatch-through: 18 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/2497dac55648e738b643577e807bfd2a3ac4c6e2 Modified Files -------------- src/backend/commands/tablecmds.c | 2 ++ src/test/regress/expected/foreign_key.out | 53 +++++++++++++++++++++++++++++++ src/test/regress/sql/foreign_key.sql | 37 +++++++++++++++++++++ 3 files changed, 92 insertions(+) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Fix FK triggers losing DEFERRABLE/INITIALLY DEFERRED when marked @ 2026-03-30 05:39 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Fujii Masao @ 2026-03-30 05:39 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix FK triggers losing DEFERRABLE/INITIALLY DEFERRED when marked ENFORCED again Previously, a foreign key defined as DEFERRABLE INITIALLY DEFERRED could behave as NOT DEFERRABLE after being set to NOT ENFORCED and then back to ENFORCED. This happened because recreating the FK triggers on re-enabling the constraint forgot to restore the tgdeferrable and tginitdeferred fields in pg_trigger. Fix this bug by properly setting those fields when the foreign key constraint is marked ENFORCED again and its triggers are recreated, so the original DEFERRABLE and INITIALLY DEFERRED properties are preserved. Backpatch to v18, where NOT ENFORCED foreign keys were introduced. Author: Yasuo Honda <yasuo.honda@gmail.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/CAKmOUTms2nkxEZDdcrsjq5P3b2L_PR266Hv8kW5pANwmVaRJJQ@mail.gmail.com Backpatch-through: 18 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/5db5e339692ed98adb5ae6ff625a92b49f770a6f Modified Files -------------- src/backend/commands/tablecmds.c | 2 ++ src/test/regress/expected/foreign_key.out | 53 +++++++++++++++++++++++++++++++ src/test/regress/sql/foreign_key.sql | 37 +++++++++++++++++++++ 3 files changed, 92 insertions(+) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-03-30 05:39 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-03-30 05:39 pgsql: Fix FK triggers losing DEFERRABLE/INITIALLY DEFERRED when marked Fujii Masao <fujii@postgresql.org> 2026-03-30 05:39 pgsql: Fix FK triggers losing DEFERRABLE/INITIALLY DEFERRED when marked Fujii Masao <fujii@postgresql.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox