diff options
Diffstat (limited to 'src/backend/executor')
-rw-r--r-- | src/backend/executor/functions.c | 22 | ||||
-rw-r--r-- | src/backend/executor/nodeAgg.c | 8 |
2 files changed, 16 insertions, 14 deletions
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c index 7e648f437b6..4781bd903ab 100644 --- a/src/backend/executor/functions.c +++ b/src/backend/executor/functions.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.112 2007/03/13 00:33:40 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.113 2007/04/02 03:49:38 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -182,7 +182,7 @@ init_sql_fcache(FmgrInfo *finfo) */ rettype = procedureStruct->prorettype; - if (rettype == ANYARRAYOID || rettype == ANYELEMENTOID) + if (IsPolymorphicType(rettype)) { rettype = get_fn_expr_rettype(finfo); if (rettype == InvalidOid) /* this probably should not happen */ @@ -218,7 +218,7 @@ init_sql_fcache(FmgrInfo *finfo) { Oid argtype = argOidVect[argnum]; - if (argtype == ANYARRAYOID || argtype == ANYELEMENTOID) + if (IsPolymorphicType(argtype)) { argtype = get_fn_expr_argtype(finfo, argnum); if (argtype == InvalidOid) @@ -845,9 +845,9 @@ ShutdownSQLFunction(Datum arg) * to be sure that the user is returning the type he claims. * * For a polymorphic function the passed rettype must be the actual resolved - * output type of the function; we should never see ANYARRAY or ANYELEMENT - * as rettype. (This means we can't check the type during function definition - * of a polymorphic function.) + * output type of the function; we should never see ANYARRAY, ANYENUM or + * ANYELEMENT as rettype. (This means we can't check the type during function + * definition of a polymorphic function.) * * The return value is true if the function returns the entire tuple result * of its final SELECT, and false otherwise. Note that because we allow @@ -925,7 +925,9 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, fn_typtype = get_typtype(rettype); - if (fn_typtype == 'b' || fn_typtype == 'd') + if (fn_typtype == TYPTYPE_BASE || + fn_typtype == TYPTYPE_DOMAIN || + fn_typtype == TYPTYPE_ENUM) { /* * For base-type returns, the target list should have exactly one @@ -948,7 +950,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, errdetail("Actual return type is %s.", format_type_be(restype)))); } - else if (fn_typtype == 'c' || rettype == RECORDOID) + else if (fn_typtype == TYPTYPE_COMPOSITE || rettype == RECORDOID) { /* Returns a rowtype */ TupleDesc tupdesc; @@ -1053,13 +1055,13 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, /* Report that we are returning entire tuple result */ return true; } - else if (rettype == ANYARRAYOID || rettype == ANYELEMENTOID) + else if (IsPolymorphicType(rettype)) { /* This should already have been caught ... */ ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), errmsg("cannot determine result data type"), - errdetail("A function returning \"anyarray\" or \"anyelement\" must have at least one argument of either type."))); + errdetail("A function returning a polymorphic type must have at least one polymorphic argument."))); } else ereport(ERROR, diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index 58e59c60c5a..d9e26d1d196 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -61,7 +61,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.151 2007/02/22 23:44:24 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.152 2007/04/02 03:49:38 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1363,8 +1363,8 @@ ExecInitAgg(Agg *node, EState *estate, int eflags) /* * Get actual datatypes of the inputs. These could be different from - * the agg's declared input types, when the agg accepts ANY, ANYARRAY - * or ANYELEMENT. + * the agg's declared input types, when the agg accepts ANY or + * a polymorphic type. */ i = 0; foreach(lc, aggref->args) @@ -1421,7 +1421,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags) /* resolve actual type of transition state, if polymorphic */ aggtranstype = aggform->aggtranstype; - if (aggtranstype == ANYARRAYOID || aggtranstype == ANYELEMENTOID) + if (IsPolymorphicType(aggtranstype)) { /* have to fetch the agg's declared input types... */ Oid *declaredArgTypes; |