Commit 7d6fbe15 authored by Tom Lane's avatar Tom Lane

Evaluate LIMIT/OFFSET expressions with ExecEvalExprSwitchContext, not

ExecEvalExpr, to avoid possible memory leak.
parent 5558e15c
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeLimit.c,v 1.6 2001/03/23 04:49:53 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeLimit.c,v 1.7 2001/08/06 18:05:07 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -164,7 +164,8 @@ recompute_limits(Limit *node) ...@@ -164,7 +164,8 @@ recompute_limits(Limit *node)
if (node->limitOffset) if (node->limitOffset)
{ {
limitstate->offset = DatumGetInt32(ExecEvalExpr(node->limitOffset, limitstate->offset =
DatumGetInt32(ExecEvalExprSwitchContext(node->limitOffset,
econtext, econtext,
&isNull, &isNull,
NULL)); NULL));
...@@ -182,7 +183,8 @@ recompute_limits(Limit *node) ...@@ -182,7 +183,8 @@ recompute_limits(Limit *node)
if (node->limitCount) if (node->limitCount)
{ {
limitstate->count = DatumGetInt32(ExecEvalExpr(node->limitCount, limitstate->count =
DatumGetInt32(ExecEvalExprSwitchContext(node->limitCount,
econtext, econtext,
&isNull, &isNull,
NULL)); NULL));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment