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

Commitbec96c8

Browse files
committed
Dump sequence data based on the TableDataInfo flag
When considering a sequence's Data entry in dumpSequenceData, we wereactually looking at the sequence definition's dump flag to decide if weshould dump the data or not. That's generally fine, except for when thesequence data entry was created by processExtensionTables() because it'sa config sequence. In that case, the sequence itself won't be marked asdumping data because it's part of an extension, leading to the need forprocessExtensionTables() to create the sequence data entry.This leads to extension config sequence data not being included in thedump when it should be. Fix this by looking at the sequence data's dumpflag instead, just as dumpTableData() was doing for tables (which is whyconfig tables were correctly being handled), and add a regression testto make sure we don't break it moving forward.All of this is a bit round-about since we can now represent whichcomponents of a given dump item should be dumped out through the dumpflag. A future improvement might be to change checkExtensionMembership()to check for config sequences/tables and set the dump flag based on thatdirectly, possibly removing the need for processExtensionTables().Bug found by Daniele Varrazzo.Discussion:https://postgr.es/m/CA+mi_8ZmxQM7+nZ7pJ8uyfxc9V3o=UAG14dVqvftdmvw8OJ3gQ@mail.gmail.comPatch by Michael Paquier, with some tweaking of the regression tests byme.Back-patch to 9.6 where the bug was introduced.
1 parent30bcebb commitbec96c8

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15671,7 +15671,7 @@ dumpSequenceData(Archive *fout, TableDataInfo *tdinfo)
1567115671
appendPQExpBuffer(query, ", %s, %s);\n",
1567215672
last, (called ? "true" : "false"));
1567315673

15674-
if (tbinfo->dobj.dump & DUMP_COMPONENT_DATA)
15674+
if (tdinfo->dobj.dump & DUMP_COMPONENT_DATA)
1567515675
ArchiveEntry(fout, nilCatalogId, createDumpId(),
1567615676
tbinfo->dobj.name,
1567715677
tbinfo->dobj.namespace->dobj.name,

‎src/test/modules/test_pg_dump/t/001_base.pl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,25 @@
265265
schema_only=> 1,
266266
section_pre_data=> 1,
267267
section_post_data=> 1, }, },
268+
'SETVAL SEQUENCE regress_seq_dumpable'=> {
269+
create_order=> 6,
270+
create_sql=>qq{SELECT nextval('regress_seq_dumpable');},
271+
regexp=>qr/^
272+
\QSELECT pg_catalog.setval('regress_seq_dumpable', 1, true);\E
273+
\n/xm,
274+
like=> {
275+
clean=> 1,
276+
clean_if_exists=> 1,
277+
createdb=> 1,
278+
data_only=> 1,
279+
defaults=> 1,
280+
no_owner=> 1,
281+
no_privs=> 1, },
282+
unlike=> {
283+
pg_dumpall_globals=> 1,
284+
schema_only=> 1,
285+
section_pre_data=> 1,
286+
section_post_data=> 1, }, },
268287
'CREATE TABLE regress_pg_dump_table'=> {
269288
regexp=>qr/^
270289
\QCREATE TABLE regress_pg_dump_table (\E

‎src/test/modules/test_pg_dump/test_pg_dump--1.0.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ CREATE TABLE regress_pg_dump_table (
1010

1111
CREATESEQUENCEregress_pg_dump_seq;
1212

13+
CREATESEQUENCEregress_seq_dumpable;
14+
SELECTpg_catalog.pg_extension_config_dump('regress_seq_dumpable','');
15+
1316
CREATESCHEMAregress_pg_dump_schema;
1417

1518
GRANT USAGEON regress_pg_dump_seq TO regress_dump_test_role;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp