diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-06-12 17:29:37 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-06-12 17:29:37 +0000 |
commit | 1e2d20910b793abd11e5b1c4355f9459affca9c5 (patch) | |
tree | 4d165d3f462c30fc90aa0b112e89526ce3d13163 /src/backend/executor/functions.c | |
parent | 0a8fc25e42fdc7eb7d77a60f07a54004ee703cc9 (diff) | |
download | postgresql-1e2d20910b793abd11e5b1c4355f9459affca9c5.tar.gz postgresql-1e2d20910b793abd11e5b1c4355f9459affca9c5.zip |
Fix SQL function executor for case where last command of a function is
not a SELECT. We didn't use to allow that, but we do now.
Diffstat (limited to 'src/backend/executor/functions.c')
-rw-r--r-- | src/backend/executor/functions.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c index b8bf811a5e8..9ee7ae1fca1 100644 --- a/src/backend/executor/functions.c +++ b/src/backend/executor/functions.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.57 2002/09/04 20:31:18 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.57.2.1 2003/06/12 17:29:37 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -273,17 +273,19 @@ postquel_getnext(execution_state *es) if (es->qd->operation == CMD_UTILITY) { - /* - * Process a utility command. (create, destroy...) DZ - 30-8-1996 - */ ProcessUtility(es->qd->parsetree->utilityStmt, es->qd->dest, NULL); - if (!LAST_POSTQUEL_COMMAND(es)) - CommandCounterIncrement(); return (TupleTableSlot *) NULL; } - /* If it's not the last command, just run it to completion */ - count = (LAST_POSTQUEL_COMMAND(es)) ? 1L : 0L; + /* + * If it's the function's last command, and it's a SELECT, fetch one + * row at a time so we can return the results. Otherwise just run it + * to completion. + */ + if (LAST_POSTQUEL_COMMAND(es) && es->qd->operation == CMD_SELECT) + count = 1L; + else + count = 0L; return ExecutorRun(es->qd, es->estate, ForwardScanDirection, count); } |