mirror of
https://github.com/postgres/postgres.git
synced 2025-10-29 22:49:41 +03:00
Allow dropping multiple functions at once
The generic drop support already supported dropping multiple objects of the same kind at once. But the previous representation of function signatures across two grammar symbols and structure members made this cumbersome to do for functions, so it was not supported. Now that function signatures are represented by a single structure, it's trivial to add this support. Same for aggregates and operators. Reviewed-by: Jim Nasby <Jim.Nasby@BlueTreble.com> Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
This commit is contained in:
@@ -358,7 +358,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
|
||||
%type <list> privileges privilege_list
|
||||
%type <privtarget> privilege_target
|
||||
%type <objwithargs> function_with_argtypes aggregate_with_argtypes operator_with_argtypes
|
||||
%type <list> function_with_argtypes_list
|
||||
%type <list> function_with_argtypes_list aggregate_with_argtypes_list operator_with_argtypes_list
|
||||
%type <ival> defacl_privilege_target
|
||||
%type <defelt> DefACLOption
|
||||
%type <list> DefACLOptionList
|
||||
@@ -7495,6 +7495,12 @@ aggregate_with_argtypes:
|
||||
}
|
||||
;
|
||||
|
||||
aggregate_with_argtypes_list:
|
||||
aggregate_with_argtypes { $$ = list_make1($1); }
|
||||
| aggregate_with_argtypes_list ',' aggregate_with_argtypes
|
||||
{ $$ = lappend($1, $3); }
|
||||
;
|
||||
|
||||
createfunc_opt_list:
|
||||
/* Must be at least one to prevent conflict */
|
||||
createfunc_opt_item { $$ = list_make1($1); }
|
||||
@@ -7676,21 +7682,21 @@ opt_restrict:
|
||||
*****************************************************************************/
|
||||
|
||||
RemoveFuncStmt:
|
||||
DROP FUNCTION function_with_argtypes opt_drop_behavior
|
||||
DROP FUNCTION function_with_argtypes_list opt_drop_behavior
|
||||
{
|
||||
DropStmt *n = makeNode(DropStmt);
|
||||
n->removeType = OBJECT_FUNCTION;
|
||||
n->objects = list_make1($3);
|
||||
n->objects = $3;
|
||||
n->behavior = $4;
|
||||
n->missing_ok = false;
|
||||
n->concurrent = false;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| DROP FUNCTION IF_P EXISTS function_with_argtypes opt_drop_behavior
|
||||
| DROP FUNCTION IF_P EXISTS function_with_argtypes_list opt_drop_behavior
|
||||
{
|
||||
DropStmt *n = makeNode(DropStmt);
|
||||
n->removeType = OBJECT_FUNCTION;
|
||||
n->objects = list_make1($5);
|
||||
n->objects = $5;
|
||||
n->behavior = $6;
|
||||
n->missing_ok = true;
|
||||
n->concurrent = false;
|
||||
@@ -7699,21 +7705,21 @@ RemoveFuncStmt:
|
||||
;
|
||||
|
||||
RemoveAggrStmt:
|
||||
DROP AGGREGATE aggregate_with_argtypes opt_drop_behavior
|
||||
DROP AGGREGATE aggregate_with_argtypes_list opt_drop_behavior
|
||||
{
|
||||
DropStmt *n = makeNode(DropStmt);
|
||||
n->removeType = OBJECT_AGGREGATE;
|
||||
n->objects = list_make1($3);
|
||||
n->objects = $3;
|
||||
n->behavior = $4;
|
||||
n->missing_ok = false;
|
||||
n->concurrent = false;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| DROP AGGREGATE IF_P EXISTS aggregate_with_argtypes opt_drop_behavior
|
||||
| DROP AGGREGATE IF_P EXISTS aggregate_with_argtypes_list opt_drop_behavior
|
||||
{
|
||||
DropStmt *n = makeNode(DropStmt);
|
||||
n->removeType = OBJECT_AGGREGATE;
|
||||
n->objects = list_make1($5);
|
||||
n->objects = $5;
|
||||
n->behavior = $6;
|
||||
n->missing_ok = true;
|
||||
n->concurrent = false;
|
||||
@@ -7722,21 +7728,21 @@ RemoveAggrStmt:
|
||||
;
|
||||
|
||||
RemoveOperStmt:
|
||||
DROP OPERATOR operator_with_argtypes opt_drop_behavior
|
||||
DROP OPERATOR operator_with_argtypes_list opt_drop_behavior
|
||||
{
|
||||
DropStmt *n = makeNode(DropStmt);
|
||||
n->removeType = OBJECT_OPERATOR;
|
||||
n->objects = list_make1($3);
|
||||
n->objects = $3;
|
||||
n->behavior = $4;
|
||||
n->missing_ok = false;
|
||||
n->concurrent = false;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| DROP OPERATOR IF_P EXISTS operator_with_argtypes opt_drop_behavior
|
||||
| DROP OPERATOR IF_P EXISTS operator_with_argtypes_list opt_drop_behavior
|
||||
{
|
||||
DropStmt *n = makeNode(DropStmt);
|
||||
n->removeType = OBJECT_OPERATOR;
|
||||
n->objects = list_make1($5);
|
||||
n->objects = $5;
|
||||
n->behavior = $6;
|
||||
n->missing_ok = true;
|
||||
n->concurrent = false;
|
||||
@@ -7768,6 +7774,12 @@ any_operator:
|
||||
{ $$ = lcons(makeString($1), $3); }
|
||||
;
|
||||
|
||||
operator_with_argtypes_list:
|
||||
operator_with_argtypes { $$ = list_make1($1); }
|
||||
| operator_with_argtypes_list ',' operator_with_argtypes
|
||||
{ $$ = lappend($1, $3); }
|
||||
;
|
||||
|
||||
operator_with_argtypes:
|
||||
any_operator oper_argtypes
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user