pgsql: Fix pg_dump for disabled triggers on partitioned tables

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix pg_dump for disabled triggers on partitioned tables
Date: 2021-07-16 21:50:31
Message-ID: E1m4Vj5-0001Sy-1A@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix pg_dump for disabled triggers on partitioned tables

pg_dump failed to preserve the 'enabled' flag (which can be not only
disabled, but also REPLICA or ALWAYS) for partitions which had it
changed from their respective parents. Attempt to handle that by
including a definition for such triggers in the dump, but replace the
standard CREATE TRIGGER line with an ALTER TRIGGER line.

Backpatch to 11, where these triggers can exist. In branches 11 and 12,
pick up a few test lines from commit b9b408c48724 to verify that
pg_upgrade is okay with these arrangements.

Co-authored-by: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Co-authored-by: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Discussion: https://postgr.es/m/20200930223450.GA14848@telsasoft.com

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ccfc3cbb341abf515d930097c4851d9e2152504f

Modified Files
--------------
src/bin/pg_dump/pg_dump.c | 94 ++++++++++++++++++++++++++++--
src/bin/pg_dump/pg_dump.h | 1 +
src/bin/pg_dump/t/002_pg_dump.pl | 73 ++++++++++++++++++++---
src/test/regress/expected/sanity_check.out | 5 ++
src/test/regress/expected/triggers.out | 14 +++++
src/test/regress/sql/triggers.sql | 15 +++++
6 files changed, 189 insertions(+), 13 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2021-07-17 15:53:24 pgsql: Doc: document the current-transaction-modes GUCs.
Previous Message Alvaro Herrera 2021-07-16 21:50:30 pgsql: Fix pg_dump for disabled triggers on partitioned tables