aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeLimit.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-08-06 18:05:07 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-08-06 18:05:07 +0000
commit7d6fbe15a2597b6f1b46e9f067c4649645e5e516 (patch)
treec0c66f624364429f0f392a053c5a40dd09a45e7e /src/backend/executor/nodeLimit.c
parent5558e15ce52c6789910f1ca5e987396f40976fae (diff)
downloadpostgresql-7d6fbe15a2597b6f1b46e9f067c4649645e5e516.tar.gz
postgresql-7d6fbe15a2597b6f1b46e9f067c4649645e5e516.zip
Evaluate LIMIT/OFFSET expressions with ExecEvalExprSwitchContext, not
ExecEvalExpr, to avoid possible memory leak.
Diffstat (limited to 'src/backend/executor/nodeLimit.c')
-rw-r--r--src/backend/executor/nodeLimit.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/backend/executor/nodeLimit.c b/src/backend/executor/nodeLimit.c
index 394f411ec4d..da0e6697763 100644
--- a/src/backend/executor/nodeLimit.c
+++ b/src/backend/executor/nodeLimit.c
@@ -8,7 +8,7 @@
*
*
* 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,10 +164,11 @@ recompute_limits(Limit *node)
if (node->limitOffset)
{
- limitstate->offset = DatumGetInt32(ExecEvalExpr(node->limitOffset,
- econtext,
- &isNull,
- NULL));
+ limitstate->offset =
+ DatumGetInt32(ExecEvalExprSwitchContext(node->limitOffset,
+ econtext,
+ &isNull,
+ NULL));
/* Interpret NULL offset as no offset */
if (isNull)
limitstate->offset = 0;
@@ -182,10 +183,11 @@ recompute_limits(Limit *node)
if (node->limitCount)
{
- limitstate->count = DatumGetInt32(ExecEvalExpr(node->limitCount,
- econtext,
- &isNull,
- NULL));
+ limitstate->count =
+ DatumGetInt32(ExecEvalExprSwitchContext(node->limitCount,
+ econtext,
+ &isNull,
+ NULL));
/* Interpret NULL count as no count (LIMIT ALL) */
if (isNull)
limitstate->noCount = true;