diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2016-04-05 18:38:54 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2016-04-05 18:38:54 -0300 |
commit | f2fcad27d59c8e5c48f8fa0a96c8355e40f24273 (patch) | |
tree | 8630b838513cbd3e2d846a68bf9db6a5f2f9c7b1 /src/backend/nodes/copyfuncs.c | |
parent | 41ea0c23761ca108e2f08f6e3151e3cb1f9652a1 (diff) |
Support ALTER THING .. DEPENDS ON EXTENSION
This introduces a new dependency type which marks an object as depending
on an extension, such that if the extension is dropped, the object
automatically goes away; and also, if the database is dumped, the object
is included in the dump output. Currently the grammar supports this for
indexes, triggers, materialized views and functions only, although the
utility code is generic so adding support for more object types is a
matter of touching the parser rules only.
Author: Abhijit Menon-Sen
Reviewed-by: Alexander Korotkov, Álvaro Herrera
Discussion: http://www.postgresql.org/message-id/20160115062649.GA5068@toroid.org
Diffstat (limited to 'src/backend/nodes/copyfuncs.c')
-rw-r--r-- | src/backend/nodes/copyfuncs.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index f4e4a91ba53..1e123d89cbb 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -3204,6 +3204,20 @@ _copyRenameStmt(const RenameStmt *from) return newnode; } +static AlterObjectDependsStmt * +_copyAlterObjectDependsStmt(const AlterObjectDependsStmt *from) +{ + AlterObjectDependsStmt *newnode = makeNode(AlterObjectDependsStmt); + + COPY_SCALAR_FIELD(objectType); + COPY_NODE_FIELD(relation); + COPY_NODE_FIELD(objname); + COPY_NODE_FIELD(objargs); + COPY_NODE_FIELD(extname); + + return newnode; +} + static AlterObjectSchemaStmt * _copyAlterObjectSchemaStmt(const AlterObjectSchemaStmt *from) { @@ -4682,6 +4696,9 @@ copyObject(const void *from) case T_RenameStmt: retval = _copyRenameStmt(from); break; + case T_AlterObjectDependsStmt: + retval = _copyAlterObjectDependsStmt(from); + break; case T_AlterObjectSchemaStmt: retval = _copyAlterObjectSchemaStmt(from); break; |