1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-27 23:21:58 +03:00

Add some defenses against functions declared to return set that don't

actually follow the protocol; per example from Kris Jurka.
This commit is contained in:
Tom Lane
2005-05-09 14:28:39 +00:00
parent 4744c1a0a1
commit 1198d63397

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.177 2005/05/06 17:24:53 tgl Exp $ * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.178 2005/05/09 14:28:39 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -948,7 +948,7 @@ ExecMakeFunctionResult(FuncExprState *fcache,
* returns set, save the current argument values to re-use * returns set, save the current argument values to re-use
* on the next call. * on the next call.
*/ */
if (fcache->func.fn_retset) if (fcache->func.fn_retset && *isDone == ExprMultipleResult)
{ {
memcpy(&fcache->setArgs, &fcinfo, sizeof(fcinfo)); memcpy(&fcache->setArgs, &fcinfo, sizeof(fcinfo));
fcache->setHasSetArg = hasSetArg; fcache->setHasSetArg = hasSetArg;
@ -967,6 +967,7 @@ ExecMakeFunctionResult(FuncExprState *fcache,
* Make sure we say we are returning a set, even if the * Make sure we say we are returning a set, even if the
* function itself doesn't return sets. * function itself doesn't return sets.
*/ */
if (hasSetArg)
*isDone = ExprMultipleResult; *isDone = ExprMultipleResult;
break; break;
} }