mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
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
This commit is contained in:
@ -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;
|
||||
|
@ -1325,6 +1325,18 @@ _equalRenameStmt(const RenameStmt *a, const RenameStmt *b)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalAlterObjectDependsStmt(const AlterObjectDependsStmt *a, const AlterObjectDependsStmt *b)
|
||||
{
|
||||
COMPARE_SCALAR_FIELD(objectType);
|
||||
COMPARE_NODE_FIELD(relation);
|
||||
COMPARE_NODE_FIELD(objname);
|
||||
COMPARE_NODE_FIELD(objargs);
|
||||
COMPARE_NODE_FIELD(extname);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalAlterObjectSchemaStmt(const AlterObjectSchemaStmt *a, const AlterObjectSchemaStmt *b)
|
||||
{
|
||||
@ -3004,6 +3016,9 @@ equal(const void *a, const void *b)
|
||||
case T_RenameStmt:
|
||||
retval = _equalRenameStmt(a, b);
|
||||
break;
|
||||
case T_AlterObjectDependsStmt:
|
||||
retval = _equalAlterObjectDependsStmt(a, b);
|
||||
break;
|
||||
case T_AlterObjectSchemaStmt:
|
||||
retval = _equalAlterObjectSchemaStmt(a, b);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user