1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +03:00

Add prokind column, replacing proisagg and proiswindow

The new column distinguishes normal functions, procedures, aggregates,
and window functions.  This replaces the existing columns proisagg and
proiswindow, and replaces the convention that procedures are indicated
by prorettype == 0.  Also change prorettype to be VOIDOID for procedures.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
This commit is contained in:
Peter Eisentraut
2018-03-02 08:57:38 -05:00
parent 1733460f02
commit fd1a421fe6
40 changed files with 3246 additions and 3174 deletions

View File

@ -1614,14 +1614,27 @@ func_get_detail(List *funcname,
*argdefaults = defaults;
}
}
if (pform->proisagg)
result = FUNCDETAIL_AGGREGATE;
else if (pform->proiswindow)
result = FUNCDETAIL_WINDOWFUNC;
else if (pform->prorettype == InvalidOid)
result = FUNCDETAIL_PROCEDURE;
else
result = FUNCDETAIL_NORMAL;
switch (pform->prokind)
{
case PROKIND_AGGREGATE:
result = FUNCDETAIL_AGGREGATE;
break;
case PROKIND_FUNCTION:
result = FUNCDETAIL_NORMAL;
break;
case PROKIND_PROCEDURE:
result = FUNCDETAIL_PROCEDURE;
break;
case PROKIND_WINDOW:
result = FUNCDETAIL_WINDOWFUNC;
break;
default:
elog(ERROR, "unrecognized prokind: %c", pform->prokind);
result = FUNCDETAIL_NORMAL; /* keep compiler quiet */
break;
}
ReleaseSysCache(ftup);
return result;
}
@ -2067,7 +2080,7 @@ LookupFuncWithArgs(ObjectType objtype, ObjectWithArgs *func, bool noError)
if (objtype == OBJECT_FUNCTION)
{
/* Make sure it's a function, not a procedure */
if (oid && get_func_rettype(oid) == InvalidOid)
if (oid && get_func_prokind(oid) == PROKIND_PROCEDURE)
{
if (noError)
return InvalidOid;
@ -2098,7 +2111,7 @@ LookupFuncWithArgs(ObjectType objtype, ObjectWithArgs *func, bool noError)
}
/* Make sure it's a procedure */
if (get_func_rettype(oid) != InvalidOid)
if (get_func_prokind(oid) != PROKIND_PROCEDURE)
{
if (noError)
return InvalidOid;
@ -2134,7 +2147,7 @@ LookupFuncWithArgs(ObjectType objtype, ObjectWithArgs *func, bool noError)
}
/* Make sure it's an aggregate */
if (!get_func_isagg(oid))
if (get_func_prokind(oid) != PROKIND_AGGREGATE)
{
if (noError)
return InvalidOid;