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

Commit562f06f

Browse files
committed
pg_dump only selected components of ACCESS METHODs
dumpAccessMethod() didn't get the memo that we now have a bitfield forthe components which should be dumped instead of a simple boolean.Correct that by checking if the relevant bit is set for each componentbeing dumped out (and not dumping it out if it isn't set).This corrects an issue where CREATE ACCESS METHOD commands were beingincluded in non-binary-upgrades when an extension included an accessmethod (as the bloom extensions does).Also add a regression test to make sure that we only dump out theACCESS METHOD commands, when they are part of an extension, when doinga binary upgrade.Pointed out by Thom Brown.
1 parent8359077 commit562f06f

File tree

3 files changed

+36
-12
lines changed

3 files changed

+36
-12
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12472,20 +12472,22 @@ dumpAccessMethod(Archive *fout, AccessMethodInfo *aminfo)
1247212472
appendPQExpBuffer(labelq, "ACCESS METHOD %s",
1247312473
qamname);
1247412474

12475-
ArchiveEntry(fout, aminfo->dobj.catId, aminfo->dobj.dumpId,
12476-
aminfo->dobj.name,
12477-
NULL,
12478-
NULL,
12479-
"",
12480-
false, "ACCESS METHOD", SECTION_PRE_DATA,
12481-
q->data, delq->data, NULL,
12482-
NULL, 0,
12483-
NULL, NULL);
12475+
if (aminfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
12476+
ArchiveEntry(fout, aminfo->dobj.catId, aminfo->dobj.dumpId,
12477+
aminfo->dobj.name,
12478+
NULL,
12479+
NULL,
12480+
"",
12481+
false, "ACCESS METHOD", SECTION_PRE_DATA,
12482+
q->data, delq->data, NULL,
12483+
NULL, 0,
12484+
NULL, NULL);
1248412485

1248512486
/* Dump Access Method Comments */
12486-
dumpComment(fout, labelq->data,
12487-
NULL, "",
12488-
aminfo->dobj.catId, 0, aminfo->dobj.dumpId);
12487+
if (aminfo->dobj.dump & DUMP_COMPONENT_COMMENT)
12488+
dumpComment(fout, labelq->data,
12489+
NULL, "",
12490+
aminfo->dobj.catId, 0, aminfo->dobj.dumpId);
1248912491

1249012492
pg_free(qamname);
1249112493

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,26 @@
317317
section_post_data => 1,
318318
},
319319
},
320+
'CREATE ACCESS METHOD regress_test_am' => {
321+
regexp => qr/^
322+
\QCREATE ACCESS METHOD regress_test_am TYPE INDEX HANDLER bthandler;\E
323+
$/xm,
324+
like => {
325+
binary_upgrade => 1,
326+
},
327+
unlike => {
328+
clean => 1,
329+
clean_if_exists => 1,
330+
createdb => 1,
331+
defaults => 1,
332+
no_privs => 1,
333+
no_owner => 1,
334+
pg_dumpall_globals => 1,
335+
schema_only => 1,
336+
section_pre_data => 1,
337+
section_post_data => 1,
338+
},
339+
},
320340
'COMMENT ON EXTENSION test_pg_dump' => {
321341
regexp => qr/^
322342
\QCOMMENT ON EXTENSION test_pg_dump\E

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ GRANT SELECT(col1) ON regress_pg_dump_table TO public;
1313

1414
GRANTSELECT(col2)ON regress_pg_dump_table TO dump_test;
1515
REVOKESELECT(col2)ON regress_pg_dump_tableFROM dump_test;
16+
17+
CREATE ACCESS METHOD regress_test_am TYPE INDEX HANDLER bthandler;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp