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

Commit5f5da0a

Browse files
committed
transformExpr() was missing some cases it ought to allow; per report
from Greg Stark. Also, twiddle the FuncCall case to not scribble onthe input structure, which was the proximate cause of the problem.Someday we ought to fix things so that transformExpr() isn't calledon already-transformed trees ...
1 parent8d33f80 commit5f5da0a

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

‎src/backend/parser/parse_expr.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.144 2003/02/10 04:44:46 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.145 2003/02/13 18:29:07 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -322,15 +322,23 @@ transformExpr(ParseState *pstate, Node *expr)
322322
caseT_FuncCall:
323323
{
324324
FuncCall*fn= (FuncCall*)expr;
325+
List*targs;
325326
List*args;
326327

327-
/* transform the list of arguments */
328-
foreach(args,fn->args)
328+
/*
329+
* Transform the list of arguments. We use a shallow
330+
* list copy and then transform-in-place to avoid O(N^2)
331+
* behavior from repeated lappend's.
332+
*/
333+
targs=listCopy(fn->args);
334+
foreach(args,targs)
335+
{
329336
lfirst(args)=transformExpr(pstate,
330337
(Node*)lfirst(args));
338+
}
331339
result=ParseFuncOrColumn(pstate,
332340
fn->funcname,
333-
fn->args,
341+
targs,
334342
fn->agg_star,
335343
fn->agg_distinct,
336344
false);
@@ -664,12 +672,15 @@ transformExpr(ParseState *pstate, Node *expr)
664672
* taking a conservative approach, and only accepting node
665673
* types that are demonstrably necessary to accept.
666674
*********************************************/
667-
caseT_Expr:
668675
caseT_Var:
669676
caseT_Const:
670677
caseT_Param:
671678
caseT_Aggref:
672679
caseT_ArrayRef:
680+
caseT_FuncExpr:
681+
caseT_OpExpr:
682+
caseT_DistinctExpr:
683+
caseT_BoolExpr:
673684
caseT_FieldSelect:
674685
caseT_RelabelType:
675686
caseT_CoerceToDomain:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp