From 69a785b8bfe076847f72317a41964821e85ccfd6 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 18 Jul 2008 03:32:53 +0000 Subject: Implement SQL-spec RETURNS TABLE syntax for functions. (Unlike the original submission, this patch treats TABLE output parameters as being entirely equivalent to OUT parameters -- tgl) Pavel Stehule --- src/backend/commands/functioncmds.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/backend/commands/functioncmds.c') diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c index d03de8bff17..2b3723d6445 100644 --- a/src/backend/commands/functioncmds.c +++ b/src/backend/commands/functioncmds.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.97 2008/07/16 16:55:23 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.98 2008/07/18 03:32:52 tgl Exp $ * * DESCRIPTION * These routines take the parse tree and pick out the @@ -228,9 +228,10 @@ examine_parameter_list(List *parameters, Oid languageOid, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), errmsg("functions cannot accept set arguments"))); - if (fp->mode != FUNC_PARAM_OUT) + /* handle input parameters */ + if (fp->mode != FUNC_PARAM_OUT && fp->mode != FUNC_PARAM_TABLE) { - /* only OUT parameters can follow a VARIADIC parameter */ + /* other input parameters can't follow a VARIADIC parameter */ if (varCount > 0) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), @@ -238,9 +239,10 @@ examine_parameter_list(List *parameters, Oid languageOid, inTypes[inCount++] = toid; } + /* handle output parameters */ if (fp->mode != FUNC_PARAM_IN && fp->mode != FUNC_PARAM_VARIADIC) { - if (outCount == 0) /* save first OUT param's type */ + if (outCount == 0) /* save first output param's type */ *requiredResultType = toid; outCount++; } -- cgit v1.2.3