diff options
| author | Peter Eisentraut | 2017-03-03 15:47:04 +0000 |
|---|---|---|
| committer | Peter Eisentraut | 2017-03-03 15:47:04 +0000 |
| commit | 6da9759a03d6d985c3b95a3177bbda7bcffd0ae6 (patch) | |
| tree | c519af3041ba6af4d54b15689351fa798d167676 /src/test | |
| parent | 713f7c47d9c38654adbc36c47fd9e439f0d1f715 (diff) | |
Add RENAME support for PUBLICATIONs and SUBSCRIPTIONs
From: Petr Jelinek <petr.jelinek@2ndquadrant.com>
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/publication.out | 10 | ||||
| -rw-r--r-- | src/test/regress/expected/subscription.out | 10 | ||||
| -rw-r--r-- | src/test/regress/sql/publication.sql | 6 | ||||
| -rw-r--r-- | src/test/regress/sql/subscription.sql | 6 | ||||
| -rw-r--r-- | src/test/subscription/t/001_rep_changes.pl | 11 |
5 files changed, 38 insertions, 5 deletions
diff --git a/src/test/regress/expected/publication.out b/src/test/regress/expected/publication.out index 5784b0fded..6416fbb914 100644 --- a/src/test/regress/expected/publication.out +++ b/src/test/regress/expected/publication.out @@ -148,7 +148,15 @@ DROP TABLE testpub_tbl1; t | t | t (1 row) -DROP PUBLICATION testpub_default; +ALTER PUBLICATION testpub_default RENAME TO testpub_foo; +\dRp testpub_foo + List of publications + Name | Owner | Inserts | Updates | Deletes +-------------+--------------------------+---------+---------+--------- + testpub_foo | regress_publication_user | t | t | t +(1 row) + +DROP PUBLICATION testpub_foo; DROP PUBLICATION testpib_ins_trunct; DROP PUBLICATION testpub_fortbl; DROP SCHEMA pub_test CASCADE; diff --git a/src/test/regress/expected/subscription.out b/src/test/regress/expected/subscription.out index 2ccec98b15..cb1ab4e791 100644 --- a/src/test/regress/expected/subscription.out +++ b/src/test/regress/expected/subscription.out @@ -61,6 +61,14 @@ ALTER SUBSCRIPTION testsub DISABLE; (1 row) COMMIT; -DROP SUBSCRIPTION testsub NODROP SLOT; +ALTER SUBSCRIPTION testsub RENAME TO testsub_foo; +\dRs + List of subscriptions + Name | Owner | Enabled | Publication +-------------+---------------------------+---------+-------------------- + testsub_foo | regress_subscription_user | f | {testpub,testpub1} +(1 row) + +DROP SUBSCRIPTION testsub_foo NODROP SLOT; RESET SESSION AUTHORIZATION; DROP ROLE regress_subscription_user; diff --git a/src/test/regress/sql/publication.sql b/src/test/regress/sql/publication.sql index 87797884d2..9563ea1857 100644 --- a/src/test/regress/sql/publication.sql +++ b/src/test/regress/sql/publication.sql @@ -73,7 +73,11 @@ DROP TABLE testpub_tbl1; \dRp+ testpub_default -DROP PUBLICATION testpub_default; +ALTER PUBLICATION testpub_default RENAME TO testpub_foo; + +\dRp testpub_foo + +DROP PUBLICATION testpub_foo; DROP PUBLICATION testpib_ins_trunct; DROP PUBLICATION testpub_fortbl; diff --git a/src/test/regress/sql/subscription.sql b/src/test/regress/sql/subscription.sql index 68c17d5cfd..fce6069a9c 100644 --- a/src/test/regress/sql/subscription.sql +++ b/src/test/regress/sql/subscription.sql @@ -38,7 +38,11 @@ ALTER SUBSCRIPTION testsub DISABLE; COMMIT; -DROP SUBSCRIPTION testsub NODROP SLOT; +ALTER SUBSCRIPTION testsub RENAME TO testsub_foo; + +\dRs + +DROP SUBSCRIPTION testsub_foo NODROP SLOT; RESET SESSION AUTHORIZATION; DROP ROLE regress_subscription_user; diff --git a/src/test/subscription/t/001_rep_changes.pl b/src/test/subscription/t/001_rep_changes.pl index fa50e495a5..fffb3c51be 100644 --- a/src/test/subscription/t/001_rep_changes.pl +++ b/src/test/subscription/t/001_rep_changes.pl @@ -169,8 +169,17 @@ $result = $node_subscriber->safe_psql('postgres', "SELECT count(*), min(a), max(a) FROM tab_full"); is($result, qq(11|0|100), 'check replicated insert after alter publication'); +# check restart on rename +$oldpid = $node_publisher->safe_psql('postgres', + "SELECT pid FROM pg_stat_replication WHERE application_name = '$appname';"); +$node_subscriber->safe_psql('postgres', + "ALTER SUBSCRIPTION tap_sub RENAME TO tap_sub_renamed"); +$node_publisher->poll_query_until('postgres', + "SELECT pid != $oldpid FROM pg_stat_replication WHERE application_name = '$appname';") + or die "Timed out while waiting for apply to restart"; + # check all the cleanup -$node_subscriber->safe_psql('postgres', "DROP SUBSCRIPTION tap_sub"); +$node_subscriber->safe_psql('postgres', "DROP SUBSCRIPTION tap_sub_renamed"); $result = $node_subscriber->safe_psql('postgres', "SELECT count(*) FROM pg_subscription"); |
