Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4aa6fa3

Browse files
author
Amit Kapila
committed
Include schema/table publications even with exclude options in dump.
The current implementation inconsistently includes public schema but notinformation_schema when those are specified in FOR TABLES IN SCHMEA ...Apart from that, the current behavior for publications w.r.t exclude tableand schema (--exclude-table, --exclude-schema) option differs from what wedo at other places. We try to avoid including publications forcorresponding tables or schemas when an exclude-table or exclude-schemaoption is given, unlike what we do for views using functions defined in aparticular schema or a subscription pointing to publications with theircorresponding exclude options.I decided not to backpatch this as it leads to a behavior change and we don'tsee any field report for current behavior.Reported-by: Tom Lane <tgl@sss.pgh.pa.us>Author: Vignesh C <vignesh21@gmail.com>Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>Discussion:https://postgr.es/m/1270733.1734134272@sss.pgh.pa.us
1 parentf11674f commit4aa6fa3

File tree

2 files changed

+28
-31
lines changed

2 files changed

+28
-31
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4536,13 +4536,6 @@ getPublicationNamespaces(Archive *fout)
45364536
if (nspinfo == NULL)
45374537
continue;
45384538

4539-
/*
4540-
* We always dump publication namespaces unless the corresponding
4541-
* namespace is excluded from the dump.
4542-
*/
4543-
if (nspinfo->dobj.dump == DUMP_COMPONENT_NONE)
4544-
continue;
4545-
45464539
/* OK, make a DumpableObject for this relationship */
45474540
pubsinfo[j].dobj.objType = DO_PUBLICATION_TABLE_IN_SCHEMA;
45484541
pubsinfo[j].dobj.catId.tableoid =
@@ -4642,13 +4635,6 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables)
46424635
if (tbinfo == NULL)
46434636
continue;
46444637

4645-
/*
4646-
* Ignore publication membership of tables whose definitions are not
4647-
* to be dumped.
4648-
*/
4649-
if (!(tbinfo->dobj.dump & DUMP_COMPONENT_DEFINITION))
4650-
continue;
4651-
46524638
/* OK, make a DumpableObject for this relationship */
46534639
pubrinfo[j].dobj.objType = DO_PUBLICATION_REL;
46544640
pubrinfo[j].dobj.catId.tableoid =

‎src/bin/pg_dump/t/002_pg_dump.pl

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3094,6 +3094,10 @@
30943094
like => {%full_runs, section_post_data => 1, },
30953095
},
30963096
3097+
3098+
# Regardless of whether the table or schema is excluded, publications must
3099+
# still be dumped, as excluded objects do not apply to publications. We
3100+
# perform table and schema exclusion via full_runs.
30973101
'ALTER PUBLICATION pub1 ADD TABLE test_table' => {
30983102
create_order => 51,
30993103
create_sql =>
@@ -3102,12 +3106,11 @@
31023106
\QALTER PUBLICATION pub1 ADD TABLE ONLY dump_test.test_table;\E
31033107
/xm,
31043108
like => {%full_runs, section_post_data => 1, },
3105-
unlike => {
3106-
exclude_dump_test_schema => 1,
3107-
exclude_test_table => 1,
3108-
},
31093109
},
31103110
3111+
# Regardless of whether the table or schema is excluded, publications must
3112+
# still be dumped, as excluded objects do not apply to publications. We
3113+
# perform table and schema exclusion via full_runs.
31113114
'ALTER PUBLICATION pub1 ADD TABLE test_second_table' => {
31123115
create_order => 52,
31133116
create_sql =>
@@ -3116,9 +3119,11 @@
31163119
\QALTER PUBLICATION pub1 ADD TABLE ONLY dump_test.test_second_table;\E
31173120
/xm,
31183121
like => {%full_runs, section_post_data => 1, },
3119-
unlike => { exclude_dump_test_schema => 1, },
31203122
},
31213123
3124+
# Regardless of whether the table or schema is excluded, publications must
3125+
# still be dumped, as excluded objects do not apply to publications. We
3126+
# perform table and schema exclusion via full_runs.
31223127
'ALTER PUBLICATION pub1 ADD TABLE test_sixth_table (col3, col2)' => {
31233128
create_order => 52,
31243129
create_sql =>
@@ -3127,9 +3132,11 @@
31273132
\QALTER PUBLICATION pub1 ADD TABLE ONLY dump_test.test_sixth_table (col2, col3);\E
31283133
/xm,
31293134
like => {%full_runs, section_post_data => 1, },
3130-
unlike => { exclude_dump_test_schema => 1, },
31313135
},
31323136
3137+
# Regardless of whether the table or schema is excluded, publications must
3138+
# still be dumped, as excluded objects do not apply to publications. We
3139+
# perform table and schema exclusion via full_runs.
31333140
'ALTER PUBLICATION pub1 ADD TABLE test_seventh_table (col3, col2) WHERE (col1 = 1)'
31343141
=> {
31353142
create_order => 52,
@@ -3139,9 +3146,11 @@
31393146
\QALTER PUBLICATION pub1 ADD TABLE ONLY dump_test.test_seventh_table (col2, col3) WHERE ((col1 = 1));\E
31403147
/xm,
31413148
like => {%full_runs, section_post_data => 1, },
3142-
unlike => { exclude_dump_test_schema => 1, },
31433149
},
31443150
3151+
# Regardless of whether the table or schema is excluded, publications must
3152+
# still be dumped, as excluded objects do not apply to publications. We
3153+
# perform table and schema exclusion via full_runs.
31453154
'ALTER PUBLICATION pub3 ADD TABLES IN SCHEMA dump_test' => {
31463155
create_order => 51,
31473156
create_sql =>
@@ -3150,9 +3159,11 @@
31503159
\QALTER PUBLICATION pub3 ADD TABLES IN SCHEMA dump_test;\E
31513160
/xm,
31523161
like => {%full_runs, section_post_data => 1, },
3153-
unlike => { exclude_dump_test_schema => 1, },
31543162
},
31553163
3164+
# Regardless of whether the table or schema is excluded, publications must
3165+
# still be dumped, as excluded objects do not apply to publications. We
3166+
# perform table and schema exclusion via full_runs.
31563167
'ALTER PUBLICATION pub3 ADD TABLES IN SCHEMA public' => {
31573168
create_order => 52,
31583169
create_sql => 'ALTER PUBLICATION pub3 ADD TABLES IN SCHEMA public;',
@@ -3162,6 +3173,9 @@
31623173
like => {%full_runs, section_post_data => 1, },
31633174
},
31643175
3176+
# Regardless of whether the table or schema is excluded, publications must
3177+
# still be dumped, as excluded objects do not apply to publications. We
3178+
# perform table and schema exclusion via full_runs.
31653179
'ALTER PUBLICATION pub3 ADD TABLE test_table' => {
31663180
create_order => 51,
31673181
create_sql =>
@@ -3170,12 +3184,11 @@
31703184
\QALTER PUBLICATION pub3 ADD TABLE ONLY dump_test.test_table;\E
31713185
/xm,
31723186
like => {%full_runs, section_post_data => 1, },
3173-
unlike => {
3174-
exclude_dump_test_schema => 1,
3175-
exclude_test_table => 1,
3176-
},
31773187
},
31783188
3189+
# Regardless of whether the table or schema is excluded, publications must
3190+
# still be dumped, as excluded objects do not apply to publications. We
3191+
# perform table and schema exclusion via full_runs.
31793192
'ALTER PUBLICATION pub4 ADD TABLE test_table WHERE (col1 > 0);' => {
31803193
create_order => 51,
31813194
create_sql =>
@@ -3184,12 +3197,11 @@
31843197
\QALTER PUBLICATION pub4 ADD TABLE ONLY dump_test.test_table WHERE ((col1 > 0));\E
31853198
/xm,
31863199
like => {%full_runs, section_post_data => 1, },
3187-
unlike => {
3188-
exclude_dump_test_schema => 1,
3189-
exclude_test_table => 1,
3190-
},
31913200
},
31923201
3202+
# Regardless of whether the table or schema is excluded, publications must
3203+
# still be dumped, as excluded objects do not apply to publications. We
3204+
# perform table and schema exclusion via full_runs.
31933205
'ALTER PUBLICATION pub4 ADD TABLE test_second_table WHERE (col2 =\'test\');'
31943206
=> {
31953207
create_order => 52,
@@ -3199,7 +3211,6 @@
31993211
\QALTER PUBLICATION pub4 ADD TABLE ONLY dump_test.test_second_table WHERE ((col2 = 'test'::text));\E
32003212
/xm,
32013213
like => {%full_runs, section_post_data => 1, },
3202-
unlike => { exclude_dump_test_schema => 1, },
32033214
},
32043215
32053216
'CREATE SCHEMA public' => {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp