mirror of
https://github.com/postgres/postgres.git
synced 2025-07-12 21:01:52 +03:00
Add ALTER .. NO DEPENDS ON
Commit f2fcad27d5
(9.6 era) added the ability to mark objects as
dependent an extension, but forgot to add a way for such dependencies to
be removed. This commit fixes that oversight.
Strictly speaking this should be backpatched to 9.6, but due to lack of
demand we're not doing so at this time.
Discussion: https://postgr.es/m/20200217225333.GA30974@alvherre.pgsql
Reviewed-by: ahsan hadi <ahsan.hadi@gmail.com>
Reviewed-by: Ibrar Ahmed <ibrar.ahmad@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
This commit is contained in:
@ -320,7 +320,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
|
||||
%type <list> vac_analyze_option_list
|
||||
%type <node> vac_analyze_option_arg
|
||||
%type <defelt> drop_option
|
||||
%type <boolean> opt_or_replace
|
||||
%type <boolean> opt_or_replace opt_no
|
||||
opt_grant_grant_option opt_grant_admin_option
|
||||
opt_nowait opt_if_exists opt_with_data
|
||||
opt_transaction_chain
|
||||
@ -9053,57 +9053,67 @@ opt_set_data: SET DATA_P { $$ = 1; }
|
||||
*****************************************************************************/
|
||||
|
||||
AlterObjectDependsStmt:
|
||||
ALTER FUNCTION function_with_argtypes DEPENDS ON EXTENSION name
|
||||
ALTER FUNCTION function_with_argtypes opt_no DEPENDS ON EXTENSION name
|
||||
{
|
||||
AlterObjectDependsStmt *n = makeNode(AlterObjectDependsStmt);
|
||||
n->objectType = OBJECT_FUNCTION;
|
||||
n->object = (Node *) $3;
|
||||
n->extname = makeString($7);
|
||||
n->extname = makeString($8);
|
||||
n->remove = $4;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| ALTER PROCEDURE function_with_argtypes DEPENDS ON EXTENSION name
|
||||
| ALTER PROCEDURE function_with_argtypes opt_no DEPENDS ON EXTENSION name
|
||||
{
|
||||
AlterObjectDependsStmt *n = makeNode(AlterObjectDependsStmt);
|
||||
n->objectType = OBJECT_PROCEDURE;
|
||||
n->object = (Node *) $3;
|
||||
n->extname = makeString($7);
|
||||
n->extname = makeString($8);
|
||||
n->remove = $4;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| ALTER ROUTINE function_with_argtypes DEPENDS ON EXTENSION name
|
||||
| ALTER ROUTINE function_with_argtypes opt_no DEPENDS ON EXTENSION name
|
||||
{
|
||||
AlterObjectDependsStmt *n = makeNode(AlterObjectDependsStmt);
|
||||
n->objectType = OBJECT_ROUTINE;
|
||||
n->object = (Node *) $3;
|
||||
n->extname = makeString($7);
|
||||
n->extname = makeString($8);
|
||||
n->remove = $4;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| ALTER TRIGGER name ON qualified_name DEPENDS ON EXTENSION name
|
||||
| ALTER TRIGGER name ON qualified_name opt_no DEPENDS ON EXTENSION name
|
||||
{
|
||||
AlterObjectDependsStmt *n = makeNode(AlterObjectDependsStmt);
|
||||
n->objectType = OBJECT_TRIGGER;
|
||||
n->relation = $5;
|
||||
n->object = (Node *) list_make1(makeString($3));
|
||||
n->extname = makeString($9);
|
||||
n->extname = makeString($10);
|
||||
n->remove = $6;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| ALTER MATERIALIZED VIEW qualified_name DEPENDS ON EXTENSION name
|
||||
| ALTER MATERIALIZED VIEW qualified_name opt_no DEPENDS ON EXTENSION name
|
||||
{
|
||||
AlterObjectDependsStmt *n = makeNode(AlterObjectDependsStmt);
|
||||
n->objectType = OBJECT_MATVIEW;
|
||||
n->relation = $4;
|
||||
n->extname = makeString($8);
|
||||
n->extname = makeString($9);
|
||||
n->remove = $5;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| ALTER INDEX qualified_name DEPENDS ON EXTENSION name
|
||||
| ALTER INDEX qualified_name opt_no DEPENDS ON EXTENSION name
|
||||
{
|
||||
AlterObjectDependsStmt *n = makeNode(AlterObjectDependsStmt);
|
||||
n->objectType = OBJECT_INDEX;
|
||||
n->relation = $3;
|
||||
n->extname = makeString($7);
|
||||
n->extname = makeString($8);
|
||||
n->remove = $4;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
;
|
||||
|
||||
opt_no: NO { $$ = true; }
|
||||
| /* EMPTY */ { $$ = false; }
|
||||
;
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* ALTER THING name SET SCHEMA name
|
||||
|
Reference in New Issue
Block a user