From bebaf7061318cbc82c3077d472d09df38626668a Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 22 Sep 2004 17:41:51 +0000 Subject: 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. --- src/backend/executor/nodeFunctionscan.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/backend/executor/nodeFunctionscan.c') 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); } -- cgit v1.2.3