summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2021-07-16 17:29:22 -0400
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2021-07-16 17:29:22 -0400
commitcc340af3345370c7faf0ceba7dece97b40312cb2 (patch)
treec5ee45b0c126ab5020f0170dd31b3cc35164d96f /src/test
parentc31516ae5b43d8a1a99e8e43abc84d791ce15ef1 (diff)
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@telsasoft.com> Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.org> Discussion: https://postgr.es/m/20200930223450.GA14848@telsasoft.com
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/sanity_check.out2
-rw-r--r--src/test/regress/expected/triggers.out5
-rw-r--r--src/test/regress/sql/triggers.sql5
3 files changed, 12 insertions, 0 deletions
diff --git a/src/test/regress/expected/sanity_check.out b/src/test/regress/expected/sanity_check.out
index 192445878d2..1030a03a578 100644
--- a/src/test/regress/expected/sanity_check.out
+++ b/src/test/regress/expected/sanity_check.out
@@ -211,6 +211,8 @@ tmp|f
trigger_parted|t
trigger_parted_p1|t
trigger_parted_p1_1|t
+trigger_parted_p2|t
+trigger_parted_p2_2|t
varchar_tbl|f
view_base_table|t
-- restore normal output mode
diff --git a/src/test/regress/expected/triggers.out b/src/test/regress/expected/triggers.out
index 5dbb0a0aa29..207e0d37795 100644
--- a/src/test/regress/expected/triggers.out
+++ b/src/test/regress/expected/triggers.out
@@ -3257,6 +3257,11 @@ create trigger aft_row after insert or update on trigger_parted
create table trigger_parted_p1 partition of trigger_parted for values in (1)
partition by list (a);
create table trigger_parted_p1_1 partition of trigger_parted_p1 for values in (1);
+create table trigger_parted_p2 partition of trigger_parted for values in (2)
+ partition by list (a);
+create table trigger_parted_p2_2 partition of trigger_parted_p2 for values in (2);
+alter table only trigger_parted_p2 disable trigger aft_row;
+alter table trigger_parted_p2_2 enable always trigger aft_row;
-- verify transition table conversion slot's lifetime
-- https://postgr.es/m/39a71864-b120-5a5c-8cc5-c632b6f16761@amazon.com
create table convslot_test_parent (col1 text primary key);
diff --git a/src/test/regress/sql/triggers.sql b/src/test/regress/sql/triggers.sql
index f8e23f034b4..c1917ca3c58 100644
--- a/src/test/regress/sql/triggers.sql
+++ b/src/test/regress/sql/triggers.sql
@@ -2415,6 +2415,11 @@ create trigger aft_row after insert or update on trigger_parted
create table trigger_parted_p1 partition of trigger_parted for values in (1)
partition by list (a);
create table trigger_parted_p1_1 partition of trigger_parted_p1 for values in (1);
+create table trigger_parted_p2 partition of trigger_parted for values in (2)
+ partition by list (a);
+create table trigger_parted_p2_2 partition of trigger_parted_p2 for values in (2);
+alter table only trigger_parted_p2 disable trigger aft_row;
+alter table trigger_parted_p2_2 enable always trigger aft_row;
-- verify transition table conversion slot's lifetime
-- https://postgr.es/m/39a71864-b120-5a5c-8cc5-c632b6f16761@amazon.com