diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 296273ba4a..89cf0274ed 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -12472,20 +12472,22 @@ dumpAccessMethod(Archive *fout, AccessMethodInfo *aminfo) appendPQExpBuffer(labelq, "ACCESS METHOD %s", qamname); - ArchiveEntry(fout, aminfo->dobj.catId, aminfo->dobj.dumpId, - aminfo->dobj.name, - NULL, - NULL, - "", - false, "ACCESS METHOD", SECTION_PRE_DATA, - q->data, delq->data, NULL, - NULL, 0, - NULL, NULL); + if (aminfo->dobj.dump & DUMP_COMPONENT_DEFINITION) + ArchiveEntry(fout, aminfo->dobj.catId, aminfo->dobj.dumpId, + aminfo->dobj.name, + NULL, + NULL, + "", + false, "ACCESS METHOD", SECTION_PRE_DATA, + q->data, delq->data, NULL, + NULL, 0, + NULL, NULL); /* Dump Access Method Comments */ - dumpComment(fout, labelq->data, - NULL, "", - aminfo->dobj.catId, 0, aminfo->dobj.dumpId); + if (aminfo->dobj.dump & DUMP_COMPONENT_COMMENT) + dumpComment(fout, labelq->data, + NULL, "", + aminfo->dobj.catId, 0, aminfo->dobj.dumpId); pg_free(qamname); diff --git a/src/test/modules/test_pg_dump/t/001_base.pl b/src/test/modules/test_pg_dump/t/001_base.pl index 2177df8bba..626eb4b758 100644 --- a/src/test/modules/test_pg_dump/t/001_base.pl +++ b/src/test/modules/test_pg_dump/t/001_base.pl @@ -317,6 +317,26 @@ my %tests = ( section_post_data => 1, }, }, + 'CREATE ACCESS METHOD regress_test_am' => { + regexp => qr/^ + \QCREATE ACCESS METHOD regress_test_am TYPE INDEX HANDLER bthandler;\E + $/xm, + like => { + binary_upgrade => 1, + }, + unlike => { + clean => 1, + clean_if_exists => 1, + createdb => 1, + defaults => 1, + no_privs => 1, + no_owner => 1, + pg_dumpall_globals => 1, + schema_only => 1, + section_pre_data => 1, + section_post_data => 1, + }, + }, 'COMMENT ON EXTENSION test_pg_dump' => { regexp => qr/^ \QCOMMENT ON EXTENSION test_pg_dump \E diff --git a/src/test/modules/test_pg_dump/test_pg_dump--1.0.sql b/src/test/modules/test_pg_dump/test_pg_dump--1.0.sql index d1ec58d023..e2bcd480e0 100644 --- a/src/test/modules/test_pg_dump/test_pg_dump--1.0.sql +++ b/src/test/modules/test_pg_dump/test_pg_dump--1.0.sql @@ -13,3 +13,5 @@ GRANT SELECT(col1) ON regress_pg_dump_table TO public; GRANT SELECT(col2) ON regress_pg_dump_table TO dump_test; REVOKE SELECT(col2) ON regress_pg_dump_table FROM dump_test; + +CREATE ACCESS METHOD regress_test_am TYPE INDEX HANDLER bthandler;