Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f40334b

Browse files
committed
Add ALTER EXTENSION ADD/DROP ACCESS METHOD, and use it in pg_upgrade.
Without this, an extension containing an access method is not properly dumped/restored during pg_upgrade --- the AM ends up not being a member of the extension after upgrading. Another oversight in commit 473b932, reported by Andrew Dunstan. Report: <f7ac29f3-515c-2a44-21c5-ec925053265f@dunslane.net>
1 parent 4677fe9 commit f40334b

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

doc/src/sgml/ref/alter_extension.sgml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ ALTER EXTENSION <replaceable class="PARAMETER">name</replaceable> DROP <replacea
3030

3131
<phrase>where <replaceable class="PARAMETER">member_object</replaceable> is:</phrase>
3232

33+
ACCESS METHOD <replaceable class="PARAMETER">object_name</replaceable> |
3334
AGGREGATE <replaceable class="PARAMETER">aggregate_name</replaceable> ( <replaceable>aggregate_signature</replaceable> ) |
3435
CAST (<replaceable>source_type</replaceable> AS <replaceable>target_type</replaceable>) |
3536
COLLATION <replaceable class="PARAMETER">object_name</replaceable> |

src/backend/parser/gram.y

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3929,7 +3929,16 @@ alter_extension_opt_item:
39293929
*****************************************************************************/
39303930

39313931
AlterExtensionContentsStmt:
3932-
ALTER EXTENSION name add_drop AGGREGATE func_name aggr_args
3932+
ALTER EXTENSION name add_drop ACCESS METHOD name
3933+
{
3934+
AlterExtensionContentsStmt *n = makeNode(AlterExtensionContentsStmt);
3935+
n->extname = $3;
3936+
n->action = $4;
3937+
n->objtype = OBJECT_ACCESS_METHOD;
3938+
n->objname = list_make1(makeString($7));
3939+
$$ = (Node *)n;
3940+
}
3941+
| ALTER EXTENSION name add_drop AGGREGATE func_name aggr_args
39333942
{
39343943
AlterExtensionContentsStmt *n = makeNode(AlterExtensionContentsStmt);
39353944
n->extname = $3;

src/bin/pg_dump/pg_dump.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12505,6 +12505,9 @@ dumpAccessMethod(Archive *fout, AccessMethodInfo *aminfo)
1250512505
appendPQExpBuffer(labelq, "ACCESS METHOD %s",
1250612506
qamname);
1250712507

12508+
if (dopt->binary_upgrade)
12509+
binary_upgrade_extension_member(q, &aminfo->dobj, labelq->data);
12510+
1250812511
if (aminfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
1250912512
ArchiveEntry(fout, aminfo->dobj.catId, aminfo->dobj.dumpId,
1251012513
aminfo->dobj.name,

0 commit comments

Comments
 (0)