Skip to content

Commit e8bdee2

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 728ceba commit e8bdee2

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
@@ -3931,7 +3931,16 @@ alter_extension_opt_item:
39313931
*****************************************************************************/
39323932

39333933
AlterExtensionContentsStmt:
3934-
ALTER EXTENSION name add_drop AGGREGATE func_name aggr_args
3934+
ALTER EXTENSION name add_drop ACCESS METHOD name
3935+
{
3936+
AlterExtensionContentsStmt *n = makeNode(AlterExtensionContentsStmt);
3937+
n->extname = $3;
3938+
n->action = $4;
3939+
n->objtype = OBJECT_ACCESS_METHOD;
3940+
n->objname = list_make1(makeString($7));
3941+
$$ = (Node *)n;
3942+
}
3943+
| ALTER EXTENSION name add_drop AGGREGATE func_name aggr_args
39353944
{
39363945
AlterExtensionContentsStmt *n = makeNode(AlterExtensionContentsStmt);
39373946
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy