diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-07-18 03:32:53 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-07-18 03:32:53 +0000 |
commit | 69a785b8bfe076847f72317a41964821e85ccfd6 (patch) | |
tree | 8089a0c1e3b1075d81f49a82ab73b443dbe7d564 /src/backend/commands/functioncmds.c | |
parent | a8fb90cf2db614f3c1d4331bfaafd9a1953148e9 (diff) | |
download | postgresql-69a785b8bfe076847f72317a41964821e85ccfd6.tar.gz postgresql-69a785b8bfe076847f72317a41964821e85ccfd6.zip |
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
Diffstat (limited to 'src/backend/commands/functioncmds.c')
-rw-r--r-- | src/backend/commands/functioncmds.c | 10 |
1 files changed, 6 insertions, 4 deletions
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++; } |