Add operator_with_argtypes grammar rule
This makes the handling of operators similar to that of functions and aggregates. Rename node FuncWithArgs to ObjectWithArgs, to reflect the expanded use. Reviewed-by: Jim Nasby <Jim.Nasby@BlueTreble.com> Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
This commit is contained in:
parent
63ebd377a6
commit
550214a4ef
|
@ -667,11 +667,11 @@ objectNamesToOids(GrantObjectType objtype, List *objnames)
|
||||||
case ACL_OBJECT_FUNCTION:
|
case ACL_OBJECT_FUNCTION:
|
||||||
foreach(cell, objnames)
|
foreach(cell, objnames)
|
||||||
{
|
{
|
||||||
FuncWithArgs *func = (FuncWithArgs *) lfirst(cell);
|
ObjectWithArgs *func = (ObjectWithArgs *) lfirst(cell);
|
||||||
Oid funcid;
|
Oid funcid;
|
||||||
|
|
||||||
funcid = LookupFuncNameTypeNames(func->funcname,
|
funcid = LookupFuncNameTypeNames(func->objname,
|
||||||
func->funcargs, false);
|
func->objargs, false);
|
||||||
objects = lappend_oid(objects, funcid);
|
objects = lappend_oid(objects, funcid);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1181,8 +1181,8 @@ AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt)
|
||||||
|
|
||||||
rel = heap_open(ProcedureRelationId, RowExclusiveLock);
|
rel = heap_open(ProcedureRelationId, RowExclusiveLock);
|
||||||
|
|
||||||
funcOid = LookupFuncNameTypeNames(stmt->func->funcname,
|
funcOid = LookupFuncNameTypeNames(stmt->func->objname,
|
||||||
stmt->func->funcargs,
|
stmt->func->objargs,
|
||||||
false);
|
false);
|
||||||
|
|
||||||
tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(funcOid));
|
tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(funcOid));
|
||||||
|
@ -1194,13 +1194,13 @@ AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt)
|
||||||
/* Permission check: must own function */
|
/* Permission check: must own function */
|
||||||
if (!pg_proc_ownercheck(funcOid, GetUserId()))
|
if (!pg_proc_ownercheck(funcOid, GetUserId()))
|
||||||
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC,
|
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC,
|
||||||
NameListToString(stmt->func->funcname));
|
NameListToString(stmt->func->objname));
|
||||||
|
|
||||||
if (procForm->proisagg)
|
if (procForm->proisagg)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||||
errmsg("\"%s\" is an aggregate function",
|
errmsg("\"%s\" is an aggregate function",
|
||||||
NameListToString(stmt->func->funcname))));
|
NameListToString(stmt->func->objname))));
|
||||||
|
|
||||||
/* Examine requested actions. */
|
/* Examine requested actions. */
|
||||||
foreach(l, stmt->actions)
|
foreach(l, stmt->actions)
|
||||||
|
@ -1453,8 +1453,8 @@ CreateCast(CreateCastStmt *stmt)
|
||||||
{
|
{
|
||||||
Form_pg_proc procstruct;
|
Form_pg_proc procstruct;
|
||||||
|
|
||||||
funcid = LookupFuncNameTypeNames(stmt->func->funcname,
|
funcid = LookupFuncNameTypeNames(stmt->func->objname,
|
||||||
stmt->func->funcargs,
|
stmt->func->objargs,
|
||||||
false);
|
false);
|
||||||
|
|
||||||
tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
|
tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
|
||||||
|
@ -1836,14 +1836,14 @@ CreateTransform(CreateTransformStmt *stmt)
|
||||||
*/
|
*/
|
||||||
if (stmt->fromsql)
|
if (stmt->fromsql)
|
||||||
{
|
{
|
||||||
fromsqlfuncid = LookupFuncNameTypeNames(stmt->fromsql->funcname, stmt->fromsql->funcargs, false);
|
fromsqlfuncid = LookupFuncNameTypeNames(stmt->fromsql->objname, stmt->fromsql->objargs, false);
|
||||||
|
|
||||||
if (!pg_proc_ownercheck(fromsqlfuncid, GetUserId()))
|
if (!pg_proc_ownercheck(fromsqlfuncid, GetUserId()))
|
||||||
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC, NameListToString(stmt->fromsql->funcname));
|
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC, NameListToString(stmt->fromsql->objname));
|
||||||
|
|
||||||
aclresult = pg_proc_aclcheck(fromsqlfuncid, GetUserId(), ACL_EXECUTE);
|
aclresult = pg_proc_aclcheck(fromsqlfuncid, GetUserId(), ACL_EXECUTE);
|
||||||
if (aclresult != ACLCHECK_OK)
|
if (aclresult != ACLCHECK_OK)
|
||||||
aclcheck_error(aclresult, ACL_KIND_PROC, NameListToString(stmt->fromsql->funcname));
|
aclcheck_error(aclresult, ACL_KIND_PROC, NameListToString(stmt->fromsql->objname));
|
||||||
|
|
||||||
tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(fromsqlfuncid));
|
tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(fromsqlfuncid));
|
||||||
if (!HeapTupleIsValid(tuple))
|
if (!HeapTupleIsValid(tuple))
|
||||||
|
@ -1862,14 +1862,14 @@ CreateTransform(CreateTransformStmt *stmt)
|
||||||
|
|
||||||
if (stmt->tosql)
|
if (stmt->tosql)
|
||||||
{
|
{
|
||||||
tosqlfuncid = LookupFuncNameTypeNames(stmt->tosql->funcname, stmt->tosql->funcargs, false);
|
tosqlfuncid = LookupFuncNameTypeNames(stmt->tosql->objname, stmt->tosql->objargs, false);
|
||||||
|
|
||||||
if (!pg_proc_ownercheck(tosqlfuncid, GetUserId()))
|
if (!pg_proc_ownercheck(tosqlfuncid, GetUserId()))
|
||||||
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC, NameListToString(stmt->tosql->funcname));
|
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC, NameListToString(stmt->tosql->objname));
|
||||||
|
|
||||||
aclresult = pg_proc_aclcheck(tosqlfuncid, GetUserId(), ACL_EXECUTE);
|
aclresult = pg_proc_aclcheck(tosqlfuncid, GetUserId(), ACL_EXECUTE);
|
||||||
if (aclresult != ACLCHECK_OK)
|
if (aclresult != ACLCHECK_OK)
|
||||||
aclcheck_error(aclresult, ACL_KIND_PROC, NameListToString(stmt->tosql->funcname));
|
aclcheck_error(aclresult, ACL_KIND_PROC, NameListToString(stmt->tosql->objname));
|
||||||
|
|
||||||
tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(tosqlfuncid));
|
tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(tosqlfuncid));
|
||||||
if (!HeapTupleIsValid(tuple))
|
if (!HeapTupleIsValid(tuple))
|
||||||
|
|
|
@ -2954,13 +2954,13 @@ _copyGrantStmt(const GrantStmt *from)
|
||||||
return newnode;
|
return newnode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FuncWithArgs *
|
static ObjectWithArgs *
|
||||||
_copyFuncWithArgs(const FuncWithArgs *from)
|
_copyObjectWithArgs(const ObjectWithArgs *from)
|
||||||
{
|
{
|
||||||
FuncWithArgs *newnode = makeNode(FuncWithArgs);
|
ObjectWithArgs *newnode = makeNode(ObjectWithArgs);
|
||||||
|
|
||||||
COPY_NODE_FIELD(funcname);
|
COPY_NODE_FIELD(objname);
|
||||||
COPY_NODE_FIELD(funcargs);
|
COPY_NODE_FIELD(objargs);
|
||||||
|
|
||||||
return newnode;
|
return newnode;
|
||||||
}
|
}
|
||||||
|
@ -5274,8 +5274,8 @@ copyObject(const void *from)
|
||||||
case T_CommonTableExpr:
|
case T_CommonTableExpr:
|
||||||
retval = _copyCommonTableExpr(from);
|
retval = _copyCommonTableExpr(from);
|
||||||
break;
|
break;
|
||||||
case T_FuncWithArgs:
|
case T_ObjectWithArgs:
|
||||||
retval = _copyFuncWithArgs(from);
|
retval = _copyObjectWithArgs(from);
|
||||||
break;
|
break;
|
||||||
case T_AccessPriv:
|
case T_AccessPriv:
|
||||||
retval = _copyAccessPriv(from);
|
retval = _copyAccessPriv(from);
|
||||||
|
|
|
@ -1095,10 +1095,10 @@ _equalGrantStmt(const GrantStmt *a, const GrantStmt *b)
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
_equalFuncWithArgs(const FuncWithArgs *a, const FuncWithArgs *b)
|
_equalObjectWithArgs(const ObjectWithArgs *a, const ObjectWithArgs *b)
|
||||||
{
|
{
|
||||||
COMPARE_NODE_FIELD(funcname);
|
COMPARE_NODE_FIELD(objname);
|
||||||
COMPARE_NODE_FIELD(funcargs);
|
COMPARE_NODE_FIELD(objargs);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -3532,8 +3532,8 @@ equal(const void *a, const void *b)
|
||||||
case T_CommonTableExpr:
|
case T_CommonTableExpr:
|
||||||
retval = _equalCommonTableExpr(a, b);
|
retval = _equalCommonTableExpr(a, b);
|
||||||
break;
|
break;
|
||||||
case T_FuncWithArgs:
|
case T_ObjectWithArgs:
|
||||||
retval = _equalFuncWithArgs(a, b);
|
retval = _equalObjectWithArgs(a, b);
|
||||||
break;
|
break;
|
||||||
case T_AccessPriv:
|
case T_AccessPriv:
|
||||||
retval = _equalAccessPriv(a, b);
|
retval = _equalAccessPriv(a, b);
|
||||||
|
|
|
@ -218,7 +218,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
|
||||||
TypeName *typnam;
|
TypeName *typnam;
|
||||||
FunctionParameter *fun_param;
|
FunctionParameter *fun_param;
|
||||||
FunctionParameterMode fun_param_mode;
|
FunctionParameterMode fun_param_mode;
|
||||||
FuncWithArgs *funwithargs;
|
ObjectWithArgs *objwithargs;
|
||||||
DefElem *defelt;
|
DefElem *defelt;
|
||||||
SortBy *sortby;
|
SortBy *sortby;
|
||||||
WindowDef *windef;
|
WindowDef *windef;
|
||||||
|
@ -357,7 +357,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
|
||||||
%type <accesspriv> privilege
|
%type <accesspriv> privilege
|
||||||
%type <list> privileges privilege_list
|
%type <list> privileges privilege_list
|
||||||
%type <privtarget> privilege_target
|
%type <privtarget> privilege_target
|
||||||
%type <funwithargs> function_with_argtypes aggregate_with_argtypes
|
%type <objwithargs> function_with_argtypes aggregate_with_argtypes operator_with_argtypes
|
||||||
%type <list> function_with_argtypes_list
|
%type <list> function_with_argtypes_list
|
||||||
%type <ival> defacl_privilege_target
|
%type <ival> defacl_privilege_target
|
||||||
%type <defelt> DefACLOption
|
%type <defelt> DefACLOption
|
||||||
|
@ -4255,8 +4255,8 @@ AlterExtensionContentsStmt:
|
||||||
n->extname = $3;
|
n->extname = $3;
|
||||||
n->action = $4;
|
n->action = $4;
|
||||||
n->objtype = OBJECT_AGGREGATE;
|
n->objtype = OBJECT_AGGREGATE;
|
||||||
n->objname = $6->funcname;
|
n->objname = $6->objname;
|
||||||
n->objargs = $6->funcargs;
|
n->objargs = $6->objargs;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| ALTER EXTENSION name add_drop CAST '(' Typename AS Typename ')'
|
| ALTER EXTENSION name add_drop CAST '(' Typename AS Typename ')'
|
||||||
|
@ -4302,8 +4302,8 @@ AlterExtensionContentsStmt:
|
||||||
n->extname = $3;
|
n->extname = $3;
|
||||||
n->action = $4;
|
n->action = $4;
|
||||||
n->objtype = OBJECT_FUNCTION;
|
n->objtype = OBJECT_FUNCTION;
|
||||||
n->objname = $6->funcname;
|
n->objname = $6->objname;
|
||||||
n->objargs = $6->funcargs;
|
n->objargs = $6->objargs;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| ALTER EXTENSION name add_drop opt_procedural LANGUAGE name
|
| ALTER EXTENSION name add_drop opt_procedural LANGUAGE name
|
||||||
|
@ -4315,14 +4315,14 @@ AlterExtensionContentsStmt:
|
||||||
n->objname = list_make1(makeString($7));
|
n->objname = list_make1(makeString($7));
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| ALTER EXTENSION name add_drop OPERATOR any_operator oper_argtypes
|
| ALTER EXTENSION name add_drop OPERATOR operator_with_argtypes
|
||||||
{
|
{
|
||||||
AlterExtensionContentsStmt *n = makeNode(AlterExtensionContentsStmt);
|
AlterExtensionContentsStmt *n = makeNode(AlterExtensionContentsStmt);
|
||||||
n->extname = $3;
|
n->extname = $3;
|
||||||
n->action = $4;
|
n->action = $4;
|
||||||
n->objtype = OBJECT_OPERATOR;
|
n->objtype = OBJECT_OPERATOR;
|
||||||
n->objname = $6;
|
n->objname = $6->objname;
|
||||||
n->objargs = $7;
|
n->objargs = $6->objargs;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| ALTER EXTENSION name add_drop OPERATOR CLASS any_name USING access_method
|
| ALTER EXTENSION name add_drop OPERATOR CLASS any_name USING access_method
|
||||||
|
@ -5798,23 +5798,23 @@ opclass_item:
|
||||||
n->order_family = $4;
|
n->order_family = $4;
|
||||||
$$ = (Node *) n;
|
$$ = (Node *) n;
|
||||||
}
|
}
|
||||||
| OPERATOR Iconst any_operator oper_argtypes opclass_purpose
|
| OPERATOR Iconst operator_with_argtypes opclass_purpose
|
||||||
opt_recheck
|
opt_recheck
|
||||||
{
|
{
|
||||||
CreateOpClassItem *n = makeNode(CreateOpClassItem);
|
CreateOpClassItem *n = makeNode(CreateOpClassItem);
|
||||||
n->itemtype = OPCLASS_ITEM_OPERATOR;
|
n->itemtype = OPCLASS_ITEM_OPERATOR;
|
||||||
n->name = $3;
|
n->name = $3->objname;
|
||||||
n->args = $4;
|
n->args = $3->objargs;
|
||||||
n->number = $2;
|
n->number = $2;
|
||||||
n->order_family = $5;
|
n->order_family = $4;
|
||||||
$$ = (Node *) n;
|
$$ = (Node *) n;
|
||||||
}
|
}
|
||||||
| FUNCTION Iconst function_with_argtypes
|
| FUNCTION Iconst function_with_argtypes
|
||||||
{
|
{
|
||||||
CreateOpClassItem *n = makeNode(CreateOpClassItem);
|
CreateOpClassItem *n = makeNode(CreateOpClassItem);
|
||||||
n->itemtype = OPCLASS_ITEM_FUNCTION;
|
n->itemtype = OPCLASS_ITEM_FUNCTION;
|
||||||
n->name = $3->funcname;
|
n->name = $3->objname;
|
||||||
n->args = $3->funcargs;
|
n->args = $3->objargs;
|
||||||
n->number = $2;
|
n->number = $2;
|
||||||
$$ = (Node *) n;
|
$$ = (Node *) n;
|
||||||
}
|
}
|
||||||
|
@ -5822,8 +5822,8 @@ opclass_item:
|
||||||
{
|
{
|
||||||
CreateOpClassItem *n = makeNode(CreateOpClassItem);
|
CreateOpClassItem *n = makeNode(CreateOpClassItem);
|
||||||
n->itemtype = OPCLASS_ITEM_FUNCTION;
|
n->itemtype = OPCLASS_ITEM_FUNCTION;
|
||||||
n->name = $6->funcname;
|
n->name = $6->objname;
|
||||||
n->args = $6->funcargs;
|
n->args = $6->objargs;
|
||||||
n->number = $2;
|
n->number = $2;
|
||||||
n->class_args = $4;
|
n->class_args = $4;
|
||||||
$$ = (Node *) n;
|
$$ = (Node *) n;
|
||||||
|
@ -6219,8 +6219,8 @@ CommentStmt:
|
||||||
{
|
{
|
||||||
CommentStmt *n = makeNode(CommentStmt);
|
CommentStmt *n = makeNode(CommentStmt);
|
||||||
n->objtype = OBJECT_AGGREGATE;
|
n->objtype = OBJECT_AGGREGATE;
|
||||||
n->objname = $4->funcname;
|
n->objname = $4->objname;
|
||||||
n->objargs = $4->funcargs;
|
n->objargs = $4->objargs;
|
||||||
n->comment = $6;
|
n->comment = $6;
|
||||||
$$ = (Node *) n;
|
$$ = (Node *) n;
|
||||||
}
|
}
|
||||||
|
@ -6228,18 +6228,18 @@ CommentStmt:
|
||||||
{
|
{
|
||||||
CommentStmt *n = makeNode(CommentStmt);
|
CommentStmt *n = makeNode(CommentStmt);
|
||||||
n->objtype = OBJECT_FUNCTION;
|
n->objtype = OBJECT_FUNCTION;
|
||||||
n->objname = $4->funcname;
|
n->objname = $4->objname;
|
||||||
n->objargs = $4->funcargs;
|
n->objargs = $4->objargs;
|
||||||
n->comment = $6;
|
n->comment = $6;
|
||||||
$$ = (Node *) n;
|
$$ = (Node *) n;
|
||||||
}
|
}
|
||||||
| COMMENT ON OPERATOR any_operator oper_argtypes IS comment_text
|
| COMMENT ON OPERATOR operator_with_argtypes IS comment_text
|
||||||
{
|
{
|
||||||
CommentStmt *n = makeNode(CommentStmt);
|
CommentStmt *n = makeNode(CommentStmt);
|
||||||
n->objtype = OBJECT_OPERATOR;
|
n->objtype = OBJECT_OPERATOR;
|
||||||
n->objname = $4;
|
n->objname = $4->objname;
|
||||||
n->objargs = $5;
|
n->objargs = $4->objargs;
|
||||||
n->comment = $7;
|
n->comment = $6;
|
||||||
$$ = (Node *) n;
|
$$ = (Node *) n;
|
||||||
}
|
}
|
||||||
| COMMENT ON CONSTRAINT name ON any_name IS comment_text
|
| COMMENT ON CONSTRAINT name ON any_name IS comment_text
|
||||||
|
@ -6427,8 +6427,8 @@ SecLabelStmt:
|
||||||
SecLabelStmt *n = makeNode(SecLabelStmt);
|
SecLabelStmt *n = makeNode(SecLabelStmt);
|
||||||
n->provider = $3;
|
n->provider = $3;
|
||||||
n->objtype = OBJECT_AGGREGATE;
|
n->objtype = OBJECT_AGGREGATE;
|
||||||
n->objname = $6->funcname;
|
n->objname = $6->objname;
|
||||||
n->objargs = $6->funcargs;
|
n->objargs = $6->objargs;
|
||||||
n->label = $8;
|
n->label = $8;
|
||||||
$$ = (Node *) n;
|
$$ = (Node *) n;
|
||||||
}
|
}
|
||||||
|
@ -6438,8 +6438,8 @@ SecLabelStmt:
|
||||||
SecLabelStmt *n = makeNode(SecLabelStmt);
|
SecLabelStmt *n = makeNode(SecLabelStmt);
|
||||||
n->provider = $3;
|
n->provider = $3;
|
||||||
n->objtype = OBJECT_FUNCTION;
|
n->objtype = OBJECT_FUNCTION;
|
||||||
n->objname = $6->funcname;
|
n->objname = $6->objname;
|
||||||
n->objargs = $6->funcargs;
|
n->objargs = $6->objargs;
|
||||||
n->label = $8;
|
n->label = $8;
|
||||||
$$ = (Node *) n;
|
$$ = (Node *) n;
|
||||||
}
|
}
|
||||||
|
@ -7280,9 +7280,9 @@ function_with_argtypes_list:
|
||||||
function_with_argtypes:
|
function_with_argtypes:
|
||||||
func_name func_args
|
func_name func_args
|
||||||
{
|
{
|
||||||
FuncWithArgs *n = makeNode(FuncWithArgs);
|
ObjectWithArgs *n = makeNode(ObjectWithArgs);
|
||||||
n->funcname = $1;
|
n->objname = $1;
|
||||||
n->funcargs = extractArgTypes($2);
|
n->objargs = extractArgTypes($2);
|
||||||
$$ = n;
|
$$ = n;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
@ -7492,9 +7492,9 @@ aggr_args_list:
|
||||||
aggregate_with_argtypes:
|
aggregate_with_argtypes:
|
||||||
func_name aggr_args
|
func_name aggr_args
|
||||||
{
|
{
|
||||||
FuncWithArgs *n = makeNode(FuncWithArgs);
|
ObjectWithArgs *n = makeNode(ObjectWithArgs);
|
||||||
n->funcname = $1;
|
n->objname = $1;
|
||||||
n->funcargs = extractAggrArgTypes($2);
|
n->objargs = extractAggrArgTypes($2);
|
||||||
$$ = n;
|
$$ = n;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
@ -7684,8 +7684,8 @@ RemoveFuncStmt:
|
||||||
{
|
{
|
||||||
DropStmt *n = makeNode(DropStmt);
|
DropStmt *n = makeNode(DropStmt);
|
||||||
n->removeType = OBJECT_FUNCTION;
|
n->removeType = OBJECT_FUNCTION;
|
||||||
n->objects = list_make1($3->funcname);
|
n->objects = list_make1($3->objname);
|
||||||
n->arguments = list_make1($3->funcargs);
|
n->arguments = list_make1($3->objargs);
|
||||||
n->behavior = $4;
|
n->behavior = $4;
|
||||||
n->missing_ok = false;
|
n->missing_ok = false;
|
||||||
n->concurrent = false;
|
n->concurrent = false;
|
||||||
|
@ -7695,8 +7695,8 @@ RemoveFuncStmt:
|
||||||
{
|
{
|
||||||
DropStmt *n = makeNode(DropStmt);
|
DropStmt *n = makeNode(DropStmt);
|
||||||
n->removeType = OBJECT_FUNCTION;
|
n->removeType = OBJECT_FUNCTION;
|
||||||
n->objects = list_make1($5->funcname);
|
n->objects = list_make1($5->objname);
|
||||||
n->arguments = list_make1($5->funcargs);
|
n->arguments = list_make1($5->objargs);
|
||||||
n->behavior = $6;
|
n->behavior = $6;
|
||||||
n->missing_ok = true;
|
n->missing_ok = true;
|
||||||
n->concurrent = false;
|
n->concurrent = false;
|
||||||
|
@ -7709,8 +7709,8 @@ RemoveAggrStmt:
|
||||||
{
|
{
|
||||||
DropStmt *n = makeNode(DropStmt);
|
DropStmt *n = makeNode(DropStmt);
|
||||||
n->removeType = OBJECT_AGGREGATE;
|
n->removeType = OBJECT_AGGREGATE;
|
||||||
n->objects = list_make1($3->funcname);
|
n->objects = list_make1($3->objname);
|
||||||
n->arguments = list_make1($3->funcargs);
|
n->arguments = list_make1($3->objargs);
|
||||||
n->behavior = $4;
|
n->behavior = $4;
|
||||||
n->missing_ok = false;
|
n->missing_ok = false;
|
||||||
n->concurrent = false;
|
n->concurrent = false;
|
||||||
|
@ -7720,8 +7720,8 @@ RemoveAggrStmt:
|
||||||
{
|
{
|
||||||
DropStmt *n = makeNode(DropStmt);
|
DropStmt *n = makeNode(DropStmt);
|
||||||
n->removeType = OBJECT_AGGREGATE;
|
n->removeType = OBJECT_AGGREGATE;
|
||||||
n->objects = list_make1($5->funcname);
|
n->objects = list_make1($5->objname);
|
||||||
n->arguments = list_make1($5->funcargs);
|
n->arguments = list_make1($5->objargs);
|
||||||
n->behavior = $6;
|
n->behavior = $6;
|
||||||
n->missing_ok = true;
|
n->missing_ok = true;
|
||||||
n->concurrent = false;
|
n->concurrent = false;
|
||||||
|
@ -7730,24 +7730,24 @@ RemoveAggrStmt:
|
||||||
;
|
;
|
||||||
|
|
||||||
RemoveOperStmt:
|
RemoveOperStmt:
|
||||||
DROP OPERATOR any_operator oper_argtypes opt_drop_behavior
|
DROP OPERATOR operator_with_argtypes opt_drop_behavior
|
||||||
{
|
{
|
||||||
DropStmt *n = makeNode(DropStmt);
|
DropStmt *n = makeNode(DropStmt);
|
||||||
n->removeType = OBJECT_OPERATOR;
|
n->removeType = OBJECT_OPERATOR;
|
||||||
n->objects = list_make1($3);
|
n->objects = list_make1($3->objname);
|
||||||
n->arguments = list_make1($4);
|
n->arguments = list_make1($3->objargs);
|
||||||
n->behavior = $5;
|
n->behavior = $4;
|
||||||
n->missing_ok = false;
|
n->missing_ok = false;
|
||||||
n->concurrent = false;
|
n->concurrent = false;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| DROP OPERATOR IF_P EXISTS any_operator oper_argtypes opt_drop_behavior
|
| DROP OPERATOR IF_P EXISTS operator_with_argtypes opt_drop_behavior
|
||||||
{
|
{
|
||||||
DropStmt *n = makeNode(DropStmt);
|
DropStmt *n = makeNode(DropStmt);
|
||||||
n->removeType = OBJECT_OPERATOR;
|
n->removeType = OBJECT_OPERATOR;
|
||||||
n->objects = list_make1($5);
|
n->objects = list_make1($5->objname);
|
||||||
n->arguments = list_make1($6);
|
n->arguments = list_make1($5->objargs);
|
||||||
n->behavior = $7;
|
n->behavior = $6;
|
||||||
n->missing_ok = true;
|
n->missing_ok = true;
|
||||||
n->concurrent = false;
|
n->concurrent = false;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
|
@ -7778,6 +7778,16 @@ any_operator:
|
||||||
{ $$ = lcons(makeString($1), $3); }
|
{ $$ = lcons(makeString($1), $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
operator_with_argtypes:
|
||||||
|
any_operator oper_argtypes
|
||||||
|
{
|
||||||
|
ObjectWithArgs *n = makeNode(ObjectWithArgs);
|
||||||
|
n->objname = $1;
|
||||||
|
n->objargs = $2;
|
||||||
|
$$ = n;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* DO <anonymous code block> [ LANGUAGE language ]
|
* DO <anonymous code block> [ LANGUAGE language ]
|
||||||
|
@ -8025,8 +8035,8 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
|
||||||
{
|
{
|
||||||
RenameStmt *n = makeNode(RenameStmt);
|
RenameStmt *n = makeNode(RenameStmt);
|
||||||
n->renameType = OBJECT_AGGREGATE;
|
n->renameType = OBJECT_AGGREGATE;
|
||||||
n->object = $3->funcname;
|
n->object = $3->objname;
|
||||||
n->objarg = $3->funcargs;
|
n->objarg = $3->objargs;
|
||||||
n->newname = $6;
|
n->newname = $6;
|
||||||
n->missing_ok = false;
|
n->missing_ok = false;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
|
@ -8089,8 +8099,8 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
|
||||||
{
|
{
|
||||||
RenameStmt *n = makeNode(RenameStmt);
|
RenameStmt *n = makeNode(RenameStmt);
|
||||||
n->renameType = OBJECT_FUNCTION;
|
n->renameType = OBJECT_FUNCTION;
|
||||||
n->object = $3->funcname;
|
n->object = $3->objname;
|
||||||
n->objarg = $3->funcargs;
|
n->objarg = $3->objargs;
|
||||||
n->newname = $6;
|
n->newname = $6;
|
||||||
n->missing_ok = false;
|
n->missing_ok = false;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
|
@ -8527,8 +8537,8 @@ AlterObjectDependsStmt:
|
||||||
AlterObjectDependsStmt *n = makeNode(AlterObjectDependsStmt);
|
AlterObjectDependsStmt *n = makeNode(AlterObjectDependsStmt);
|
||||||
n->objectType = OBJECT_FUNCTION;
|
n->objectType = OBJECT_FUNCTION;
|
||||||
n->relation = NULL;
|
n->relation = NULL;
|
||||||
n->objname = $3->funcname;
|
n->objname = $3->objname;
|
||||||
n->objargs = $3->funcargs;
|
n->objargs = $3->objargs;
|
||||||
n->extname = makeString($7);
|
n->extname = makeString($7);
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
|
@ -8575,8 +8585,8 @@ AlterObjectSchemaStmt:
|
||||||
{
|
{
|
||||||
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
|
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
|
||||||
n->objectType = OBJECT_AGGREGATE;
|
n->objectType = OBJECT_AGGREGATE;
|
||||||
n->object = $3->funcname;
|
n->object = $3->objname;
|
||||||
n->objarg = $3->funcargs;
|
n->objarg = $3->objargs;
|
||||||
n->newschema = $6;
|
n->newschema = $6;
|
||||||
n->missing_ok = false;
|
n->missing_ok = false;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
|
@ -8621,19 +8631,19 @@ AlterObjectSchemaStmt:
|
||||||
{
|
{
|
||||||
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
|
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
|
||||||
n->objectType = OBJECT_FUNCTION;
|
n->objectType = OBJECT_FUNCTION;
|
||||||
n->object = $3->funcname;
|
n->object = $3->objname;
|
||||||
n->objarg = $3->funcargs;
|
n->objarg = $3->objargs;
|
||||||
n->newschema = $6;
|
n->newschema = $6;
|
||||||
n->missing_ok = false;
|
n->missing_ok = false;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| ALTER OPERATOR any_operator oper_argtypes SET SCHEMA name
|
| ALTER OPERATOR operator_with_argtypes SET SCHEMA name
|
||||||
{
|
{
|
||||||
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
|
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
|
||||||
n->objectType = OBJECT_OPERATOR;
|
n->objectType = OBJECT_OPERATOR;
|
||||||
n->object = $3;
|
n->object = $3->objname;
|
||||||
n->objarg = $4;
|
n->objarg = $3->objargs;
|
||||||
n->newschema = $7;
|
n->newschema = $6;
|
||||||
n->missing_ok = false;
|
n->missing_ok = false;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
|
@ -8799,12 +8809,12 @@ AlterObjectSchemaStmt:
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
AlterOperatorStmt:
|
AlterOperatorStmt:
|
||||||
ALTER OPERATOR any_operator oper_argtypes SET '(' operator_def_list ')'
|
ALTER OPERATOR operator_with_argtypes SET '(' operator_def_list ')'
|
||||||
{
|
{
|
||||||
AlterOperatorStmt *n = makeNode(AlterOperatorStmt);
|
AlterOperatorStmt *n = makeNode(AlterOperatorStmt);
|
||||||
n->opername = $3;
|
n->opername = $3->objname;
|
||||||
n->operargs = $4;
|
n->operargs = $3->objargs;
|
||||||
n->options = $7;
|
n->options = $6;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
@ -8829,8 +8839,8 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
|
||||||
{
|
{
|
||||||
AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
|
AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
|
||||||
n->objectType = OBJECT_AGGREGATE;
|
n->objectType = OBJECT_AGGREGATE;
|
||||||
n->object = $3->funcname;
|
n->object = $3->objname;
|
||||||
n->objarg = $3->funcargs;
|
n->objarg = $3->objargs;
|
||||||
n->newowner = $6;
|
n->newowner = $6;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
|
@ -8870,8 +8880,8 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
|
||||||
{
|
{
|
||||||
AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
|
AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
|
||||||
n->objectType = OBJECT_FUNCTION;
|
n->objectType = OBJECT_FUNCTION;
|
||||||
n->object = $3->funcname;
|
n->object = $3->objname;
|
||||||
n->objarg = $3->funcargs;
|
n->objarg = $3->objargs;
|
||||||
n->newowner = $6;
|
n->newowner = $6;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
|
@ -8891,13 +8901,13 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
|
||||||
n->newowner = $7;
|
n->newowner = $7;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| ALTER OPERATOR any_operator oper_argtypes OWNER TO RoleSpec
|
| ALTER OPERATOR operator_with_argtypes OWNER TO RoleSpec
|
||||||
{
|
{
|
||||||
AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
|
AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
|
||||||
n->objectType = OBJECT_OPERATOR;
|
n->objectType = OBJECT_OPERATOR;
|
||||||
n->object = $3;
|
n->object = $3->objname;
|
||||||
n->objarg = $4;
|
n->objarg = $3->objargs;
|
||||||
n->newowner = $7;
|
n->newowner = $6;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| ALTER OPERATOR CLASS any_name USING access_method OWNER TO RoleSpec
|
| ALTER OPERATOR CLASS any_name USING access_method OWNER TO RoleSpec
|
||||||
|
|
|
@ -451,7 +451,7 @@ typedef enum NodeTag
|
||||||
T_SortGroupClause,
|
T_SortGroupClause,
|
||||||
T_GroupingSet,
|
T_GroupingSet,
|
||||||
T_WindowClause,
|
T_WindowClause,
|
||||||
T_FuncWithArgs,
|
T_ObjectWithArgs,
|
||||||
T_AccessPriv,
|
T_AccessPriv,
|
||||||
T_CreateOpClassItem,
|
T_CreateOpClassItem,
|
||||||
T_TableLikeClause,
|
T_TableLikeClause,
|
||||||
|
|
|
@ -1753,7 +1753,7 @@ typedef struct GrantStmt
|
||||||
bool is_grant; /* true = GRANT, false = REVOKE */
|
bool is_grant; /* true = GRANT, false = REVOKE */
|
||||||
GrantTargetType targtype; /* type of the grant target */
|
GrantTargetType targtype; /* type of the grant target */
|
||||||
GrantObjectType objtype; /* kind of object being operated on */
|
GrantObjectType objtype; /* kind of object being operated on */
|
||||||
List *objects; /* list of RangeVar nodes, FuncWithArgs nodes,
|
List *objects; /* list of RangeVar nodes, ObjectWithArgs nodes,
|
||||||
* or plain names (as Value strings) */
|
* or plain names (as Value strings) */
|
||||||
List *privileges; /* list of AccessPriv nodes */
|
List *privileges; /* list of AccessPriv nodes */
|
||||||
/* privileges == NIL denotes ALL PRIVILEGES */
|
/* privileges == NIL denotes ALL PRIVILEGES */
|
||||||
|
@ -1763,16 +1763,16 @@ typedef struct GrantStmt
|
||||||
} GrantStmt;
|
} GrantStmt;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note: FuncWithArgs carries only the types of the input parameters of the
|
* Note: ObjectWithArgs carries only the types of the input parameters of the
|
||||||
* function. So it is sufficient to identify an existing function, but it
|
* function. So it is sufficient to identify an existing function, but it
|
||||||
* is not enough info to define a function nor to call it.
|
* is not enough info to define a function nor to call it.
|
||||||
*/
|
*/
|
||||||
typedef struct FuncWithArgs
|
typedef struct ObjectWithArgs
|
||||||
{
|
{
|
||||||
NodeTag type;
|
NodeTag type;
|
||||||
List *funcname; /* qualified name of function */
|
List *objname; /* qualified name of function/operator */
|
||||||
List *funcargs; /* list of Typename nodes */
|
List *objargs; /* list of Typename nodes */
|
||||||
} FuncWithArgs;
|
} ObjectWithArgs;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* An access privilege, with optional list of column names
|
* An access privilege, with optional list of column names
|
||||||
|
@ -2644,7 +2644,7 @@ typedef struct FunctionParameter
|
||||||
typedef struct AlterFunctionStmt
|
typedef struct AlterFunctionStmt
|
||||||
{
|
{
|
||||||
NodeTag type;
|
NodeTag type;
|
||||||
FuncWithArgs *func; /* name and args of function */
|
ObjectWithArgs *func; /* name and args of function */
|
||||||
List *actions; /* list of DefElem */
|
List *actions; /* list of DefElem */
|
||||||
} AlterFunctionStmt;
|
} AlterFunctionStmt;
|
||||||
|
|
||||||
|
@ -3138,7 +3138,7 @@ typedef struct CreateCastStmt
|
||||||
NodeTag type;
|
NodeTag type;
|
||||||
TypeName *sourcetype;
|
TypeName *sourcetype;
|
||||||
TypeName *targettype;
|
TypeName *targettype;
|
||||||
FuncWithArgs *func;
|
ObjectWithArgs *func;
|
||||||
CoercionContext context;
|
CoercionContext context;
|
||||||
bool inout;
|
bool inout;
|
||||||
} CreateCastStmt;
|
} CreateCastStmt;
|
||||||
|
@ -3153,8 +3153,8 @@ typedef struct CreateTransformStmt
|
||||||
bool replace;
|
bool replace;
|
||||||
TypeName *type_name;
|
TypeName *type_name;
|
||||||
char *lang;
|
char *lang;
|
||||||
FuncWithArgs *fromsql;
|
ObjectWithArgs *fromsql;
|
||||||
FuncWithArgs *tosql;
|
ObjectWithArgs *tosql;
|
||||||
} CreateTransformStmt;
|
} CreateTransformStmt;
|
||||||
|
|
||||||
/* ----------------------
|
/* ----------------------
|
||||||
|
|
|
@ -745,7 +745,6 @@ FuncDetailCode
|
||||||
FuncExpr
|
FuncExpr
|
||||||
FuncExprState
|
FuncExprState
|
||||||
FuncInfo
|
FuncInfo
|
||||||
FuncWithArgs
|
|
||||||
FunctionCallInfo
|
FunctionCallInfo
|
||||||
FunctionCallInfoData
|
FunctionCallInfoData
|
||||||
FunctionParameter
|
FunctionParameter
|
||||||
|
@ -1228,6 +1227,7 @@ ObjectAddresses
|
||||||
ObjectClass
|
ObjectClass
|
||||||
ObjectPropertyType
|
ObjectPropertyType
|
||||||
ObjectType
|
ObjectType
|
||||||
|
ObjectWithArgs
|
||||||
Offset
|
Offset
|
||||||
OffsetNumber
|
OffsetNumber
|
||||||
OffsetVarNodes_context
|
OffsetVarNodes_context
|
||||||
|
|
Loading…
Reference in New Issue