aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-12-18 19:38:22 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-12-18 19:38:22 +0000
commit4ac592be6c7ca089f302eb8787df44080ee2f8ee (patch)
tree8040368a6a6f3385ce8020276f4c8da9a8687663
parent517ae4039ebe12806d76adfd3bc1fc6578fc8862 (diff)
downloadpostgresql-4ac592be6c7ca089f302eb8787df44080ee2f8ee.tar.gz
postgresql-4ac592be6c7ca089f302eb8787df44080ee2f8ee.zip
Fix oversight in my recent patch to allow ExecMakeFunctionResult to handle
materialize-mode set results. Since it now uses the ReturnSetInfo node to hold internal state, we need to be sure to set up the node even when the immediately called function doesn't return set (but does have a set-valued argument). Per report from Anupama Aherrao.
-rw-r--r--src/backend/executor/execQual.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c
index 87343b1c4e8..71aad49647d 100644
--- a/src/backend/executor/execQual.c
+++ b/src/backend/executor/execQual.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.237 2008/11/15 20:52:35 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.238 2008/12/18 19:38:22 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1434,23 +1434,6 @@ restart:
}
/*
- * If function returns set, prepare a resultinfo node for communication
- */
- if (fcache->func.fn_retset)
- {
- fcinfo->resultinfo = (Node *) &rsinfo;
- rsinfo.type = T_ReturnSetInfo;
- rsinfo.econtext = econtext;
- rsinfo.expectedDesc = fcache->funcResultDesc;
- rsinfo.allowedModes = (int) (SFRM_ValuePerCall | SFRM_Materialize);
- /* note we do not set SFRM_Materialize_Random or _Preferred */
- rsinfo.returnMode = SFRM_ValuePerCall;
- /* isDone is filled below */
- rsinfo.setResult = NULL;
- rsinfo.setDesc = NULL;
- }
-
- /*
* Now call the function, passing the evaluated parameter values.
*/
if (fcache->func.fn_retset || hasSetArg)
@@ -1465,6 +1448,23 @@ restart:
errmsg("set-valued function called in context that cannot accept a set")));
/*
+ * Prepare a resultinfo node for communication. If the function
+ * doesn't itself return set, we don't pass the resultinfo to the
+ * function, but we need to fill it in anyway for internal use.
+ */
+ if (fcache->func.fn_retset)
+ fcinfo->resultinfo = (Node *) &rsinfo;
+ rsinfo.type = T_ReturnSetInfo;
+ rsinfo.econtext = econtext;
+ rsinfo.expectedDesc = fcache->funcResultDesc;
+ rsinfo.allowedModes = (int) (SFRM_ValuePerCall | SFRM_Materialize);
+ /* note we do not set SFRM_Materialize_Random or _Preferred */
+ rsinfo.returnMode = SFRM_ValuePerCall;
+ /* isDone is filled below */
+ rsinfo.setResult = NULL;
+ rsinfo.setDesc = NULL;
+
+ /*
* This loop handles the situation where we have both a set argument
* and a set-valued function. Once we have exhausted the function's
* value(s) for a particular argument value, we have to get the next