Add operator_with_argtypes grammar rule
authorPeter Eisentraut <peter_e@gmx.net>
Wed, 28 Dec 2016 17:00:00 +0000 (12:00 -0500)
committerPeter Eisentraut <peter_e@gmx.net>
Mon, 6 Mar 2017 18:31:47 +0000 (13:31 -0500)
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>
src/backend/catalog/aclchk.c
src/backend/commands/functioncmds.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/parser/gram.y
src/include/nodes/nodes.h
src/include/nodes/parsenodes.h
src/tools/pgindent/typedefs.list

index 79b7fd5370b187460bec02ef5e4cca0562f33639..7e9ed76b801d7ca13975c9d86b637119049d7650 100644 (file)
@@ -667,11 +667,11 @@ objectNamesToOids(GrantObjectType objtype, List *objnames)
        case ACL_OBJECT_FUNCTION:
            foreach(cell, objnames)
            {
-               FuncWithArgs *func = (FuncWithArgs *) lfirst(cell);
+               ObjectWithArgs *func = (ObjectWithArgs *) lfirst(cell);
                Oid         funcid;
 
-               funcid = LookupFuncNameTypeNames(func->funcname,
-                                                func->funcargs, false);
+               funcid = LookupFuncNameTypeNames(func->objname,
+                                                func->objargs, false);
                objects = lappend_oid(objects, funcid);
            }
            break;
index 8b1285a54201a76aabef2f6166d2faa90c484374..3d1b64549e5b917de33724ca231298b506bc62ea 100644 (file)
@@ -1181,8 +1181,8 @@ AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt)
 
    rel = heap_open(ProcedureRelationId, RowExclusiveLock);
 
-   funcOid = LookupFuncNameTypeNames(stmt->func->funcname,
-                                     stmt->func->funcargs,
+   funcOid = LookupFuncNameTypeNames(stmt->func->objname,
+                                     stmt->func->objargs,
                                      false);
 
    tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(funcOid));
@@ -1194,13 +1194,13 @@ AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt)
    /* Permission check: must own function */
    if (!pg_proc_ownercheck(funcOid, GetUserId()))
        aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC,
-                      NameListToString(stmt->func->funcname));
+                      NameListToString(stmt->func->objname));
 
    if (procForm->proisagg)
        ereport(ERROR,
                (errcode(ERRCODE_WRONG_OBJECT_TYPE),
                 errmsg("\"%s\" is an aggregate function",
-                       NameListToString(stmt->func->funcname))));
+                       NameListToString(stmt->func->objname))));
 
    /* Examine requested actions. */
    foreach(l, stmt->actions)
@@ -1453,8 +1453,8 @@ CreateCast(CreateCastStmt *stmt)
    {
        Form_pg_proc procstruct;
 
-       funcid = LookupFuncNameTypeNames(stmt->func->funcname,
-                                        stmt->func->funcargs,
+       funcid = LookupFuncNameTypeNames(stmt->func->objname,
+                                        stmt->func->objargs,
                                         false);
 
        tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
@@ -1836,14 +1836,14 @@ CreateTransform(CreateTransformStmt *stmt)
     */
    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()))
-           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);
        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));
        if (!HeapTupleIsValid(tuple))
@@ -1862,14 +1862,14 @@ CreateTransform(CreateTransformStmt *stmt)
 
    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()))
-           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);
        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));
        if (!HeapTupleIsValid(tuple))
index 05d8538717a53759a5731795e86439650fa4e5c7..35fec878428e7386e336a4cfcc0201aefcae3af5 100644 (file)
@@ -2954,13 +2954,13 @@ _copyGrantStmt(const GrantStmt *from)
    return newnode;
 }
 
-static FuncWithArgs *
-_copyFuncWithArgs(const FuncWithArgs *from)
+static ObjectWithArgs *
+_copyObjectWithArgs(const ObjectWithArgs *from)
 {
-   FuncWithArgs *newnode = makeNode(FuncWithArgs);
+   ObjectWithArgs *newnode = makeNode(ObjectWithArgs);
 
-   COPY_NODE_FIELD(funcname);
-   COPY_NODE_FIELD(funcargs);
+   COPY_NODE_FIELD(objname);
+   COPY_NODE_FIELD(objargs);
 
    return newnode;
 }
@@ -5274,8 +5274,8 @@ copyObject(const void *from)
        case T_CommonTableExpr:
            retval = _copyCommonTableExpr(from);
            break;
-       case T_FuncWithArgs:
-           retval = _copyFuncWithArgs(from);
+       case T_ObjectWithArgs:
+           retval = _copyObjectWithArgs(from);
            break;
        case T_AccessPriv:
            retval = _copyAccessPriv(from);
index d595cd74812e2f60e9b3d7805ef3fa152254a5a0..e526ef96b70288a5d3d021d6dc7bf98ff866f408 100644 (file)
@@ -1095,10 +1095,10 @@ _equalGrantStmt(const GrantStmt *a, const GrantStmt *b)
 }
 
 static bool
-_equalFuncWithArgs(const FuncWithArgs *a, const FuncWithArgs *b)
+_equalObjectWithArgs(const ObjectWithArgs *a, const ObjectWithArgs *b)
 {
-   COMPARE_NODE_FIELD(funcname);
-   COMPARE_NODE_FIELD(funcargs);
+   COMPARE_NODE_FIELD(objname);
+   COMPARE_NODE_FIELD(objargs);
 
    return true;
 }
@@ -3532,8 +3532,8 @@ equal(const void *a, const void *b)
        case T_CommonTableExpr:
            retval = _equalCommonTableExpr(a, b);
            break;
-       case T_FuncWithArgs:
-           retval = _equalFuncWithArgs(a, b);
+       case T_ObjectWithArgs:
+           retval = _equalObjectWithArgs(a, b);
            break;
        case T_AccessPriv:
            retval = _equalAccessPriv(a, b);
index e7845906b4307fbf16231bf05397e80e435e85d3..3289f5cbd4a782fb6bfad86b198f158703e72299 100644 (file)
@@ -218,7 +218,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
    TypeName            *typnam;
    FunctionParameter   *fun_param;
    FunctionParameterMode fun_param_mode;
-   FuncWithArgs        *funwithargs;
+   ObjectWithArgs      *objwithargs;
    DefElem             *defelt;
    SortBy              *sortby;
    WindowDef           *windef;
@@ -357,7 +357,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
 %type <accesspriv> privilege
 %type <list>   privileges privilege_list
 %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 <ival>   defacl_privilege_target
 %type <defelt> DefACLOption
@@ -4255,8 +4255,8 @@ AlterExtensionContentsStmt:
                    n->extname = $3;
                    n->action = $4;
                    n->objtype = OBJECT_AGGREGATE;
-                   n->objname = $6->funcname;
-                   n->objargs = $6->funcargs;
+                   n->objname = $6->objname;
+                   n->objargs = $6->objargs;
                    $$ = (Node *)n;
                }
            | ALTER EXTENSION name add_drop CAST '(' Typename AS Typename ')'
@@ -4302,8 +4302,8 @@ AlterExtensionContentsStmt:
                    n->extname = $3;
                    n->action = $4;
                    n->objtype = OBJECT_FUNCTION;
-                   n->objname = $6->funcname;
-                   n->objargs = $6->funcargs;
+                   n->objname = $6->objname;
+                   n->objargs = $6->objargs;
                    $$ = (Node *)n;
                }
            | ALTER EXTENSION name add_drop opt_procedural LANGUAGE name
@@ -4315,14 +4315,14 @@ AlterExtensionContentsStmt:
                    n->objname = list_make1(makeString($7));
                    $$ = (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);
                    n->extname = $3;
                    n->action = $4;
                    n->objtype = OBJECT_OPERATOR;
-                   n->objname = $6;
-                   n->objargs = $7;
+                   n->objname = $6->objname;
+                   n->objargs = $6->objargs;
                    $$ = (Node *)n;
                }
            | ALTER EXTENSION name add_drop OPERATOR CLASS any_name USING access_method
@@ -5798,23 +5798,23 @@ opclass_item:
                    n->order_family = $4;
                    $$ = (Node *) n;
                }
-           | OPERATOR Iconst any_operator oper_argtypes opclass_purpose
+           | OPERATOR Iconst operator_with_argtypes opclass_purpose
              opt_recheck
                {
                    CreateOpClassItem *n = makeNode(CreateOpClassItem);
                    n->itemtype = OPCLASS_ITEM_OPERATOR;
-                   n->name = $3;
-                   n->args = $4;
+                   n->name = $3->objname;
+                   n->args = $3->objargs;
                    n->number = $2;
-                   n->order_family = $5;
+                   n->order_family = $4;
                    $$ = (Node *) n;
                }
            | FUNCTION Iconst function_with_argtypes
                {
                    CreateOpClassItem *n = makeNode(CreateOpClassItem);
                    n->itemtype = OPCLASS_ITEM_FUNCTION;
-                   n->name = $3->funcname;
-                   n->args = $3->funcargs;
+                   n->name = $3->objname;
+                   n->args = $3->objargs;
                    n->number = $2;
                    $$ = (Node *) n;
                }
@@ -5822,8 +5822,8 @@ opclass_item:
                {
                    CreateOpClassItem *n = makeNode(CreateOpClassItem);
                    n->itemtype = OPCLASS_ITEM_FUNCTION;
-                   n->name = $6->funcname;
-                   n->args = $6->funcargs;
+                   n->name = $6->objname;
+                   n->args = $6->objargs;
                    n->number = $2;
                    n->class_args = $4;
                    $$ = (Node *) n;
@@ -6219,8 +6219,8 @@ CommentStmt:
                {
                    CommentStmt *n = makeNode(CommentStmt);
                    n->objtype = OBJECT_AGGREGATE;
-                   n->objname = $4->funcname;
-                   n->objargs = $4->funcargs;
+                   n->objname = $4->objname;
+                   n->objargs = $4->objargs;
                    n->comment = $6;
                    $$ = (Node *) n;
                }
@@ -6228,18 +6228,18 @@ CommentStmt:
                {
                    CommentStmt *n = makeNode(CommentStmt);
                    n->objtype = OBJECT_FUNCTION;
-                   n->objname = $4->funcname;
-                   n->objargs = $4->funcargs;
+                   n->objname = $4->objname;
+                   n->objargs = $4->objargs;
                    n->comment = $6;
                    $$ = (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);
                    n->objtype = OBJECT_OPERATOR;
-                   n->objname = $4;
-                   n->objargs = $5;
-                   n->comment = $7;
+                   n->objname = $4->objname;
+                   n->objargs = $4->objargs;
+                   n->comment = $6;
                    $$ = (Node *) n;
                }
            | COMMENT ON CONSTRAINT name ON any_name IS comment_text
@@ -6427,8 +6427,8 @@ SecLabelStmt:
                    SecLabelStmt *n = makeNode(SecLabelStmt);
                    n->provider = $3;
                    n->objtype = OBJECT_AGGREGATE;
-                   n->objname = $6->funcname;
-                   n->objargs = $6->funcargs;
+                   n->objname = $6->objname;
+                   n->objargs = $6->objargs;
                    n->label = $8;
                    $$ = (Node *) n;
                }
@@ -6438,8 +6438,8 @@ SecLabelStmt:
                    SecLabelStmt *n = makeNode(SecLabelStmt);
                    n->provider = $3;
                    n->objtype = OBJECT_FUNCTION;
-                   n->objname = $6->funcname;
-                   n->objargs = $6->funcargs;
+                   n->objname = $6->objname;
+                   n->objargs = $6->objargs;
                    n->label = $8;
                    $$ = (Node *) n;
                }
@@ -7280,9 +7280,9 @@ function_with_argtypes_list:
 function_with_argtypes:
            func_name func_args
                {
-                   FuncWithArgs *n = makeNode(FuncWithArgs);
-                   n->funcname = $1;
-                   n->funcargs = extractArgTypes($2);
+                   ObjectWithArgs *n = makeNode(ObjectWithArgs);
+                   n->objname = $1;
+                   n->objargs = extractArgTypes($2);
                    $$ = n;
                }
        ;
@@ -7492,9 +7492,9 @@ aggr_args_list:
 aggregate_with_argtypes:
            func_name aggr_args
                {
-                   FuncWithArgs *n = makeNode(FuncWithArgs);
-                   n->funcname = $1;
-                   n->funcargs = extractAggrArgTypes($2);
+                   ObjectWithArgs *n = makeNode(ObjectWithArgs);
+                   n->objname = $1;
+                   n->objargs = extractAggrArgTypes($2);
                    $$ = n;
                }
        ;
@@ -7684,8 +7684,8 @@ RemoveFuncStmt:
                {
                    DropStmt *n = makeNode(DropStmt);
                    n->removeType = OBJECT_FUNCTION;
-                   n->objects = list_make1($3->funcname);
-                   n->arguments = list_make1($3->funcargs);
+                   n->objects = list_make1($3->objname);
+                   n->arguments = list_make1($3->objargs);
                    n->behavior = $4;
                    n->missing_ok = false;
                    n->concurrent = false;
@@ -7695,8 +7695,8 @@ RemoveFuncStmt:
                {
                    DropStmt *n = makeNode(DropStmt);
                    n->removeType = OBJECT_FUNCTION;
-                   n->objects = list_make1($5->funcname);
-                   n->arguments = list_make1($5->funcargs);
+                   n->objects = list_make1($5->objname);
+                   n->arguments = list_make1($5->objargs);
                    n->behavior = $6;
                    n->missing_ok = true;
                    n->concurrent = false;
@@ -7709,8 +7709,8 @@ RemoveAggrStmt:
                {
                    DropStmt *n = makeNode(DropStmt);
                    n->removeType = OBJECT_AGGREGATE;
-                   n->objects = list_make1($3->funcname);
-                   n->arguments = list_make1($3->funcargs);
+                   n->objects = list_make1($3->objname);
+                   n->arguments = list_make1($3->objargs);
                    n->behavior = $4;
                    n->missing_ok = false;
                    n->concurrent = false;
@@ -7720,8 +7720,8 @@ RemoveAggrStmt:
                {
                    DropStmt *n = makeNode(DropStmt);
                    n->removeType = OBJECT_AGGREGATE;
-                   n->objects = list_make1($5->funcname);
-                   n->arguments = list_make1($5->funcargs);
+                   n->objects = list_make1($5->objname);
+                   n->arguments = list_make1($5->objargs);
                    n->behavior = $6;
                    n->missing_ok = true;
                    n->concurrent = false;
@@ -7730,24 +7730,24 @@ RemoveAggrStmt:
        ;
 
 RemoveOperStmt:
-           DROP OPERATOR any_operator oper_argtypes opt_drop_behavior
+           DROP OPERATOR operator_with_argtypes opt_drop_behavior
                {
                    DropStmt *n = makeNode(DropStmt);
                    n->removeType = OBJECT_OPERATOR;
-                   n->objects = list_make1($3);
-                   n->arguments = list_make1($4);
-                   n->behavior = $5;
+                   n->objects = list_make1($3->objname);
+                   n->arguments = list_make1($3->objargs);
+                   n->behavior = $4;
                    n->missing_ok = false;
                    n->concurrent = false;
                    $$ = (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);
                    n->removeType = OBJECT_OPERATOR;
-                   n->objects = list_make1($5);
-                   n->arguments = list_make1($6);
-                   n->behavior = $7;
+                   n->objects = list_make1($5->objname);
+                   n->arguments = list_make1($5->objargs);
+                   n->behavior = $6;
                    n->missing_ok = true;
                    n->concurrent = false;
                    $$ = (Node *)n;
@@ -7778,6 +7778,16 @@ any_operator:
                    { $$ = 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 ]
@@ -8025,8 +8035,8 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
                {
                    RenameStmt *n = makeNode(RenameStmt);
                    n->renameType = OBJECT_AGGREGATE;
-                   n->object = $3->funcname;
-                   n->objarg = $3->funcargs;
+                   n->object = $3->objname;
+                   n->objarg = $3->objargs;
                    n->newname = $6;
                    n->missing_ok = false;
                    $$ = (Node *)n;
@@ -8089,8 +8099,8 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
                {
                    RenameStmt *n = makeNode(RenameStmt);
                    n->renameType = OBJECT_FUNCTION;
-                   n->object = $3->funcname;
-                   n->objarg = $3->funcargs;
+                   n->object = $3->objname;
+                   n->objarg = $3->objargs;
                    n->newname = $6;
                    n->missing_ok = false;
                    $$ = (Node *)n;
@@ -8527,8 +8537,8 @@ AlterObjectDependsStmt:
                    AlterObjectDependsStmt *n = makeNode(AlterObjectDependsStmt);
                    n->objectType = OBJECT_FUNCTION;
                    n->relation = NULL;
-                   n->objname = $3->funcname;
-                   n->objargs = $3->funcargs;
+                   n->objname = $3->objname;
+                   n->objargs = $3->objargs;
                    n->extname = makeString($7);
                    $$ = (Node *)n;
                }
@@ -8575,8 +8585,8 @@ AlterObjectSchemaStmt:
                {
                    AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
                    n->objectType = OBJECT_AGGREGATE;
-                   n->object = $3->funcname;
-                   n->objarg = $3->funcargs;
+                   n->object = $3->objname;
+                   n->objarg = $3->objargs;
                    n->newschema = $6;
                    n->missing_ok = false;
                    $$ = (Node *)n;
@@ -8621,19 +8631,19 @@ AlterObjectSchemaStmt:
                {
                    AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
                    n->objectType = OBJECT_FUNCTION;
-                   n->object = $3->funcname;
-                   n->objarg = $3->funcargs;
+                   n->object = $3->objname;
+                   n->objarg = $3->objargs;
                    n->newschema = $6;
                    n->missing_ok = false;
                    $$ = (Node *)n;
                }
-           | ALTER OPERATOR any_operator oper_argtypes SET SCHEMA name
+           | ALTER OPERATOR operator_with_argtypes SET SCHEMA name
                {
                    AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
                    n->objectType = OBJECT_OPERATOR;
-                   n->object = $3;
-                   n->objarg = $4;
-                   n->newschema = $7;
+                   n->object = $3->objname;
+                   n->objarg = $3->objargs;
+                   n->newschema = $6;
                    n->missing_ok = false;
                    $$ = (Node *)n;
                }
@@ -8799,12 +8809,12 @@ AlterObjectSchemaStmt:
  *****************************************************************************/
 
 AlterOperatorStmt:
-           ALTER OPERATOR any_operator oper_argtypes SET '(' operator_def_list ')'
+           ALTER OPERATOR operator_with_argtypes SET '(' operator_def_list ')'
                {
                    AlterOperatorStmt *n = makeNode(AlterOperatorStmt);
-                   n->opername = $3;
-                   n->operargs = $4;
-                   n->options = $7;
+                   n->opername = $3->objname;
+                   n->operargs = $3->objargs;
+                   n->options = $6;
                    $$ = (Node *)n;
                }
        ;
@@ -8829,8 +8839,8 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
                {
                    AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
                    n->objectType = OBJECT_AGGREGATE;
-                   n->object = $3->funcname;
-                   n->objarg = $3->funcargs;
+                   n->object = $3->objname;
+                   n->objarg = $3->objargs;
                    n->newowner = $6;
                    $$ = (Node *)n;
                }
@@ -8870,8 +8880,8 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
                {
                    AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
                    n->objectType = OBJECT_FUNCTION;
-                   n->object = $3->funcname;
-                   n->objarg = $3->funcargs;
+                   n->object = $3->objname;
+                   n->objarg = $3->objargs;
                    n->newowner = $6;
                    $$ = (Node *)n;
                }
@@ -8891,13 +8901,13 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
                    n->newowner = $7;
                    $$ = (Node *)n;
                }
-           | ALTER OPERATOR any_operator oper_argtypes OWNER TO RoleSpec
+           | ALTER OPERATOR operator_with_argtypes OWNER TO RoleSpec
                {
                    AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
                    n->objectType = OBJECT_OPERATOR;
-                   n->object = $3;
-                   n->objarg = $4;
-                   n->newowner = $7;
+                   n->object = $3->objname;
+                   n->objarg = $3->objargs;
+                   n->newowner = $6;
                    $$ = (Node *)n;
                }
            | ALTER OPERATOR CLASS any_name USING access_method OWNER TO RoleSpec
index 28aca928a85c972230bc509bbb1e7527a9c95e5f..ede7ace76b44fec49af1f3a21b17b9fdbb218d8f 100644 (file)
@@ -451,7 +451,7 @@ typedef enum NodeTag
    T_SortGroupClause,
    T_GroupingSet,
    T_WindowClause,
-   T_FuncWithArgs,
+   T_ObjectWithArgs,
    T_AccessPriv,
    T_CreateOpClassItem,
    T_TableLikeClause,
index a9d0d08b53bc72461fc90a76e923d19e39e17982..97993f519846643f0774eb5775c6ef49426ebeab 100644 (file)
@@ -1753,7 +1753,7 @@ typedef struct GrantStmt
    bool        is_grant;       /* true = GRANT, false = REVOKE */
    GrantTargetType targtype;   /* type of the grant target */
    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) */
    List       *privileges;     /* list of AccessPriv nodes */
    /* privileges == NIL denotes ALL PRIVILEGES */
@@ -1763,16 +1763,16 @@ typedef struct 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
  * is not enough info to define a function nor to call it.
  */
-typedef struct FuncWithArgs
+typedef struct ObjectWithArgs
 {
    NodeTag     type;
-   List       *funcname;       /* qualified name of function */
-   List       *funcargs;       /* list of Typename nodes */
-} FuncWithArgs;
+   List       *objname;        /* qualified name of function/operator */
+   List       *objargs;        /* list of Typename nodes */
+} ObjectWithArgs;
 
 /*
  * An access privilege, with optional list of column names
@@ -2644,7 +2644,7 @@ typedef struct FunctionParameter
 typedef struct AlterFunctionStmt
 {
    NodeTag     type;
-   FuncWithArgs *func;         /* name and args of function */
+   ObjectWithArgs *func;       /* name and args of function */
    List       *actions;        /* list of DefElem */
 } AlterFunctionStmt;
 
@@ -3138,7 +3138,7 @@ typedef struct CreateCastStmt
    NodeTag     type;
    TypeName   *sourcetype;
    TypeName   *targettype;
-   FuncWithArgs *func;
+   ObjectWithArgs *func;
    CoercionContext context;
    bool        inout;
 } CreateCastStmt;
@@ -3153,8 +3153,8 @@ typedef struct CreateTransformStmt
    bool        replace;
    TypeName   *type_name;
    char       *lang;
-   FuncWithArgs *fromsql;
-   FuncWithArgs *tosql;
+   ObjectWithArgs *fromsql;
+   ObjectWithArgs *tosql;
 } CreateTransformStmt;
 
 /* ----------------------
index 6717eccbb0092d019ff06d36555b67408968327a..3155ec6d5b4440446c6597c3b064faf62432e909 100644 (file)
@@ -745,7 +745,6 @@ FuncDetailCode
 FuncExpr
 FuncExprState
 FuncInfo
-FuncWithArgs
 FunctionCallInfo
 FunctionCallInfoData
 FunctionParameter
@@ -1228,6 +1227,7 @@ ObjectAddresses
 ObjectClass
 ObjectPropertyType
 ObjectType
+ObjectWithArgs
 Offset
 OffsetNumber
 OffsetVarNodes_context