@@ -1932,19 +1932,19 @@ LookupFuncName(List *funcname, int nargs, const Oid *argtypes, bool noError)
19321932}
19331933
19341934/*
1935- * LookupFuncNameTypeNames
1935+ * LookupFuncWithArgs
19361936 * Like LookupFuncName, but the argument types are specified by a
1937- * list of TypeName nodes .
1937+ * ObjectWithArgs node .
19381938 */
19391939Oid
1940- LookupFuncNameTypeNames ( List * funcname , List * argtypes , bool noError )
1940+ LookupFuncWithArgs ( ObjectWithArgs * func , bool noError )
19411941{
19421942 Oid argoids [FUNC_MAX_ARGS ];
19431943 int argcount ;
19441944 int i ;
19451945 ListCell * args_item ;
19461946
1947- argcount = list_length (argtypes );
1947+ argcount = list_length (func -> objargs );
19481948 if (argcount > FUNC_MAX_ARGS )
19491949 ereport (ERROR ,
19501950 (errcode (ERRCODE_TOO_MANY_ARGUMENTS ),
@@ -1953,7 +1953,7 @@ LookupFuncNameTypeNames(List *funcname, List *argtypes, bool noError)
19531953 FUNC_MAX_ARGS ,
19541954 FUNC_MAX_ARGS )));
19551955
1956- args_item = list_head (argtypes );
1956+ args_item = list_head (func -> objargs );
19571957 for (i = 0 ; i < argcount ; i ++ )
19581958 {
19591959 TypeName * t = (TypeName * ) lfirst (args_item );
@@ -1962,19 +1962,19 @@ LookupFuncNameTypeNames(List *funcname, List *argtypes, bool noError)
19621962 args_item = lnext (args_item );
19631963 }
19641964
1965- return LookupFuncName (funcname , argcount , argoids , noError );
1965+ return LookupFuncName (func -> objname , argcount , argoids , noError );
19661966}
19671967
19681968/*
1969- * LookupAggNameTypeNames
1970- * Find an aggregate function given a name and list of TypeName nodes .
1969+ * LookupAggWithArgs
1970+ * Find an aggregate function from a given ObjectWithArgs node .
19711971 *
1972- * This is almost like LookupFuncNameTypeNames , but the error messages refer
1972+ * This is almost like LookupFuncWithArgs , but the error messages refer
19731973 * to aggregates rather than plain functions, and we verify that the found
19741974 * function really is an aggregate.
19751975 */
19761976Oid
1977- LookupAggNameTypeNames ( List * aggname , List * argtypes , bool noError )
1977+ LookupAggWithArgs ( ObjectWithArgs * agg , bool noError )
19781978{
19791979 Oid argoids [FUNC_MAX_ARGS ];
19801980 int argcount ;
@@ -1984,7 +1984,7 @@ LookupAggNameTypeNames(List *aggname, List *argtypes, bool noError)
19841984 HeapTuple ftup ;
19851985 Form_pg_proc pform ;
19861986
1987- argcount = list_length (argtypes );
1987+ argcount = list_length (agg -> objargs );
19881988 if (argcount > FUNC_MAX_ARGS )
19891989 ereport (ERROR ,
19901990 (errcode (ERRCODE_TOO_MANY_ARGUMENTS ),
@@ -1994,15 +1994,15 @@ LookupAggNameTypeNames(List *aggname, List *argtypes, bool noError)
19941994 FUNC_MAX_ARGS )));
19951995
19961996 i = 0 ;
1997- foreach (lc , argtypes )
1997+ foreach (lc , agg -> objargs )
19981998 {
19991999 TypeName * t = (TypeName * ) lfirst (lc );
20002000
20012001 argoids [i ] = LookupTypeNameOid (NULL , t , noError );
20022002 i ++ ;
20032003 }
20042004
2005- oid = LookupFuncName (aggname , argcount , argoids , true);
2005+ oid = LookupFuncName (agg -> objname , argcount , argoids , true);
20062006
20072007 if (!OidIsValid (oid ))
20082008 {
@@ -2012,12 +2012,12 @@ LookupAggNameTypeNames(List *aggname, List *argtypes, bool noError)
20122012 ereport (ERROR ,
20132013 (errcode (ERRCODE_UNDEFINED_FUNCTION ),
20142014 errmsg ("aggregate %s(*) does not exist" ,
2015- NameListToString (aggname ))));
2015+ NameListToString (agg -> objname ))));
20162016 else
20172017 ereport (ERROR ,
20182018 (errcode (ERRCODE_UNDEFINED_FUNCTION ),
20192019 errmsg ("aggregate %s does not exist" ,
2020- func_signature_string (aggname , argcount ,
2020+ func_signature_string (agg -> objname , argcount ,
20212021 NIL , argoids ))));
20222022 }
20232023
@@ -2036,7 +2036,7 @@ LookupAggNameTypeNames(List *aggname, List *argtypes, bool noError)
20362036 ereport (ERROR ,
20372037 (errcode (ERRCODE_WRONG_OBJECT_TYPE ),
20382038 errmsg ("function %s is not an aggregate" ,
2039- func_signature_string (aggname , argcount ,
2039+ func_signature_string (agg -> objname , argcount ,
20402040 NIL , argoids ))));
20412041 }
20422042
0 commit comments