Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7d6fbe1

Browse files
committed
Evaluate LIMIT/OFFSET expressions with ExecEvalExprSwitchContext, not
ExecEvalExpr, to avoid possible memory leak.
1 parent5558e15 commit7d6fbe1

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

‎src/backend/executor/nodeLimit.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/executor/nodeLimit.c,v 1.6 2001/03/23 04:49:53 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/executor/nodeLimit.c,v 1.7 2001/08/06 18:05:07 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -164,10 +164,11 @@ recompute_limits(Limit *node)
164164

165165
if (node->limitOffset)
166166
{
167-
limitstate->offset=DatumGetInt32(ExecEvalExpr(node->limitOffset,
168-
econtext,
169-
&isNull,
170-
NULL));
167+
limitstate->offset=
168+
DatumGetInt32(ExecEvalExprSwitchContext(node->limitOffset,
169+
econtext,
170+
&isNull,
171+
NULL));
171172
/* Interpret NULL offset as no offset */
172173
if (isNull)
173174
limitstate->offset=0;
@@ -182,10 +183,11 @@ recompute_limits(Limit *node)
182183

183184
if (node->limitCount)
184185
{
185-
limitstate->count=DatumGetInt32(ExecEvalExpr(node->limitCount,
186-
econtext,
187-
&isNull,
188-
NULL));
186+
limitstate->count=
187+
DatumGetInt32(ExecEvalExprSwitchContext(node->limitCount,
188+
econtext,
189+
&isNull,
190+
NULL));
189191
/* Interpret NULL count as no count (LIMIT ALL) */
190192
if (isNull)
191193
limitstate->noCount= true;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp