diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-09-22 17:41:51 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-09-22 17:41:51 +0000 |
commit | bebaf7061318cbc82c3077d472d09df38626668a (patch) | |
tree | 9ea7d553fce63670a8e83124d2080c17cc357c85 /src/backend/executor/nodeFunctionscan.c | |
parent | b84788debc08f64a0cb75cbb1059a6b222c51490 (diff) | |
download | postgresql-bebaf7061318cbc82c3077d472d09df38626668a.tar.gz postgresql-bebaf7061318cbc82c3077d472d09df38626668a.zip |
Adjust ExecMakeTableFunctionResult to produce a single all-nulls row
when a function that returns a single tuple (not a setof tuple) returns
NULL. This seems to be the most consistent behavior. It would have
taken a bit less code to make it return an empty table (zero rows) but
ISTM a non-SETOF function ought always return exactly one row. Per
bug report from Ivan-Sun1.
Diffstat (limited to 'src/backend/executor/nodeFunctionscan.c')
-rw-r--r-- | src/backend/executor/nodeFunctionscan.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/backend/executor/nodeFunctionscan.c b/src/backend/executor/nodeFunctionscan.c index 5894651348d..032235b8f3e 100644 --- a/src/backend/executor/nodeFunctionscan.c +++ b/src/backend/executor/nodeFunctionscan.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeFunctionscan.c,v 1.26 2004/08/29 04:12:31 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeFunctionscan.c,v 1.27 2004/09/22 17:41:51 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -96,17 +96,10 @@ FunctionNext(FunctionScanState *node) /* * Get the next tuple from tuplestore. Return NULL if no more tuples. */ + heapTuple = tuplestore_getheaptuple(tuplestorestate, + ScanDirectionIsForward(direction), + &should_free); slot = node->ss.ss_ScanTupleSlot; - if (tuplestorestate) - heapTuple = tuplestore_getheaptuple(tuplestorestate, - ScanDirectionIsForward(direction), - &should_free); - else - { - heapTuple = NULL; - should_free = false; - } - return ExecStoreTuple(heapTuple, slot, InvalidBuffer, should_free); } |