aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_dump/pg_dump.c14
-rw-r--r--src/bin/pg_dump/t/002_pg_dump.pl45
2 files changed, 28 insertions, 31 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 30dfda8c3ff..6370bb711c0 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -4536,13 +4536,6 @@ getPublicationNamespaces(Archive *fout)
if (nspinfo == NULL)
continue;
- /*
- * We always dump publication namespaces unless the corresponding
- * namespace is excluded from the dump.
- */
- if (nspinfo->dobj.dump == DUMP_COMPONENT_NONE)
- continue;
-
/* OK, make a DumpableObject for this relationship */
pubsinfo[j].dobj.objType = DO_PUBLICATION_TABLE_IN_SCHEMA;
pubsinfo[j].dobj.catId.tableoid =
@@ -4642,13 +4635,6 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables)
if (tbinfo == NULL)
continue;
- /*
- * Ignore publication membership of tables whose definitions are not
- * to be dumped.
- */
- if (!(tbinfo->dobj.dump & DUMP_COMPONENT_DEFINITION))
- continue;
-
/* OK, make a DumpableObject for this relationship */
pubrinfo[j].dobj.objType = DO_PUBLICATION_REL;
pubrinfo[j].dobj.catId.tableoid =
diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl
index bc5d9222a20..86df03ddd9d 100644
--- a/src/bin/pg_dump/t/002_pg_dump.pl
+++ b/src/bin/pg_dump/t/002_pg_dump.pl
@@ -3094,6 +3094,10 @@ my %tests = (
like => { %full_runs, section_post_data => 1, },
},
+
+ # Regardless of whether the table or schema is excluded, publications must
+ # still be dumped, as excluded objects do not apply to publications. We
+ # perform table and schema exclusion via full_runs.
'ALTER PUBLICATION pub1 ADD TABLE test_table' => {
create_order => 51,
create_sql =>
@@ -3102,12 +3106,11 @@ my %tests = (
\QALTER PUBLICATION pub1 ADD TABLE ONLY dump_test.test_table;\E
/xm,
like => { %full_runs, section_post_data => 1, },
- unlike => {
- exclude_dump_test_schema => 1,
- exclude_test_table => 1,
- },
},
+ # Regardless of whether the table or schema is excluded, publications must
+ # still be dumped, as excluded objects do not apply to publications. We
+ # perform table and schema exclusion via full_runs.
'ALTER PUBLICATION pub1 ADD TABLE test_second_table' => {
create_order => 52,
create_sql =>
@@ -3116,9 +3119,11 @@ my %tests = (
\QALTER PUBLICATION pub1 ADD TABLE ONLY dump_test.test_second_table;\E
/xm,
like => { %full_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
},
+ # Regardless of whether the table or schema is excluded, publications must
+ # still be dumped, as excluded objects do not apply to publications. We
+ # perform table and schema exclusion via full_runs.
'ALTER PUBLICATION pub1 ADD TABLE test_sixth_table (col3, col2)' => {
create_order => 52,
create_sql =>
@@ -3127,9 +3132,11 @@ my %tests = (
\QALTER PUBLICATION pub1 ADD TABLE ONLY dump_test.test_sixth_table (col2, col3);\E
/xm,
like => { %full_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
},
+ # Regardless of whether the table or schema is excluded, publications must
+ # still be dumped, as excluded objects do not apply to publications. We
+ # perform table and schema exclusion via full_runs.
'ALTER PUBLICATION pub1 ADD TABLE test_seventh_table (col3, col2) WHERE (col1 = 1)'
=> {
create_order => 52,
@@ -3139,9 +3146,11 @@ my %tests = (
\QALTER PUBLICATION pub1 ADD TABLE ONLY dump_test.test_seventh_table (col2, col3) WHERE ((col1 = 1));\E
/xm,
like => { %full_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
},
+ # Regardless of whether the table or schema is excluded, publications must
+ # still be dumped, as excluded objects do not apply to publications. We
+ # perform table and schema exclusion via full_runs.
'ALTER PUBLICATION pub3 ADD TABLES IN SCHEMA dump_test' => {
create_order => 51,
create_sql =>
@@ -3150,9 +3159,11 @@ my %tests = (
\QALTER PUBLICATION pub3 ADD TABLES IN SCHEMA dump_test;\E
/xm,
like => { %full_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
},
+ # Regardless of whether the table or schema is excluded, publications must
+ # still be dumped, as excluded objects do not apply to publications. We
+ # perform table and schema exclusion via full_runs.
'ALTER PUBLICATION pub3 ADD TABLES IN SCHEMA public' => {
create_order => 52,
create_sql => 'ALTER PUBLICATION pub3 ADD TABLES IN SCHEMA public;',
@@ -3162,6 +3173,9 @@ my %tests = (
like => { %full_runs, section_post_data => 1, },
},
+ # Regardless of whether the table or schema is excluded, publications must
+ # still be dumped, as excluded objects do not apply to publications. We
+ # perform table and schema exclusion via full_runs.
'ALTER PUBLICATION pub3 ADD TABLE test_table' => {
create_order => 51,
create_sql =>
@@ -3170,12 +3184,11 @@ my %tests = (
\QALTER PUBLICATION pub3 ADD TABLE ONLY dump_test.test_table;\E
/xm,
like => { %full_runs, section_post_data => 1, },
- unlike => {
- exclude_dump_test_schema => 1,
- exclude_test_table => 1,
- },
},
+ # Regardless of whether the table or schema is excluded, publications must
+ # still be dumped, as excluded objects do not apply to publications. We
+ # perform table and schema exclusion via full_runs.
'ALTER PUBLICATION pub4 ADD TABLE test_table WHERE (col1 > 0);' => {
create_order => 51,
create_sql =>
@@ -3184,12 +3197,11 @@ my %tests = (
\QALTER PUBLICATION pub4 ADD TABLE ONLY dump_test.test_table WHERE ((col1 > 0));\E
/xm,
like => { %full_runs, section_post_data => 1, },
- unlike => {
- exclude_dump_test_schema => 1,
- exclude_test_table => 1,
- },
},
+ # Regardless of whether the table or schema is excluded, publications must
+ # still be dumped, as excluded objects do not apply to publications. We
+ # perform table and schema exclusion via full_runs.
'ALTER PUBLICATION pub4 ADD TABLE test_second_table WHERE (col2 = \'test\');'
=> {
create_order => 52,
@@ -3199,7 +3211,6 @@ my %tests = (
\QALTER PUBLICATION pub4 ADD TABLE ONLY dump_test.test_second_table WHERE ((col2 = 'test'::text));\E
/xm,
like => { %full_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
},
'CREATE SCHEMA public' => {