From fd1a421fe66173fb9b85d3fe150afde8e812cbe4 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 2 Mar 2018 08:57:38 -0500 Subject: 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 Reviewed-by: Michael Paquier --- src/backend/utils/adt/ruleutils.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/backend/utils/adt/ruleutils.c') diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 36974667892..b58ee3c3876 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -2481,12 +2481,12 @@ pg_get_functiondef(PG_FUNCTION_ARGS) proc = (Form_pg_proc) GETSTRUCT(proctup); name = NameStr(proc->proname); - if (proc->proisagg) + if (proc->prokind == PROKIND_AGGREGATE) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("\"%s\" is an aggregate function", name))); - isfunction = (proc->prorettype != InvalidOid); + isfunction = (proc->prokind != PROKIND_PROCEDURE); /* * We always qualify the function name, to ensure the right function gets @@ -2513,7 +2513,7 @@ pg_get_functiondef(PG_FUNCTION_ARGS) /* Emit some miscellaneous options on one line */ oldlen = buf.len; - if (proc->proiswindow) + if (proc->prokind == PROKIND_WINDOW) appendStringInfoString(&buf, " WINDOW"); switch (proc->provolatile) { @@ -2717,7 +2717,7 @@ pg_get_function_result(PG_FUNCTION_ARGS) if (!HeapTupleIsValid(proctup)) PG_RETURN_NULL(); - if (((Form_pg_proc) GETSTRUCT(proctup))->prorettype == InvalidOid) + if (((Form_pg_proc) GETSTRUCT(proctup))->prokind == PROKIND_PROCEDURE) { ReleaseSysCache(proctup); PG_RETURN_NULL(); @@ -2817,7 +2817,7 @@ print_function_arguments(StringInfo buf, HeapTuple proctup, } /* Check for special treatment of ordered-set aggregates */ - if (proc->proisagg) + if (proc->prokind == PROKIND_AGGREGATE) { HeapTuple aggtup; Form_pg_aggregate agg; -- cgit v1.2.3