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

Commitf5371fe

Browse files
committed
Fix inadequate tree-walking code in exec_eval_clear_fcache.
1 parent08ede42 commitf5371fe

File tree

1 file changed

+27
-23
lines changed

1 file changed

+27
-23
lines changed

‎src/pl/plpgsql/src/pl_exec.c

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* procedural language
44
*
55
* IDENTIFICATION
6-
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.32 2000/11/16 22:30:50 tgl Exp $
6+
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.33 2000/12/01 20:43:59 tgl Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -54,6 +54,7 @@
5454
#include"executor/spi.h"
5555
#include"executor/spi_priv.h"
5656
#include"fmgr.h"
57+
#include"optimizer/clauses.h"
5758
#include"parser/parse_expr.h"
5859
#include"tcop/tcopprot.h"
5960
#include"utils/builtins.h"
@@ -112,6 +113,7 @@ static void exec_prepare_plan(PLpgSQL_execstate * estate,
112113
staticboolexec_simple_check_node(Node*node);
113114
staticvoidexec_simple_check_plan(PLpgSQL_expr*expr);
114115
staticvoidexec_eval_clear_fcache(Node*node);
116+
staticboolexec_eval_clear_fcache_walker(Node*node,void*context);
115117
staticDatumexec_eval_simple_expr(PLpgSQL_execstate*estate,
116118
PLpgSQL_expr*expr,
117119
bool*isNull,
@@ -2593,7 +2595,7 @@ exec_eval_simple_expr(PLpgSQL_execstate * estate,
25932595
*rettype=expr->plan_simple_type;
25942596

25952597
/* ----------
2596-
* Clearthe function cache
2598+
* Clearany function cache entries in the expression tree
25972599
* ----------
25982600
*/
25992601
exec_eval_clear_fcache(expr->plan_simple_expr);
@@ -2904,33 +2906,35 @@ exec_simple_check_plan(PLpgSQL_expr * expr)
29042906
staticvoid
29052907
exec_eval_clear_fcache(Node*node)
29062908
{
2907-
Expr*expr;
2908-
List*l;
2909-
2910-
if (nodeTag(node)!=T_Expr)
2911-
return;
2912-
2913-
expr= (Expr*)node;
2909+
/* This tree walk requires no special setup, so away we go... */
2910+
exec_eval_clear_fcache_walker(node,NULL);
2911+
}
29142912

2915-
switch (expr->opType)
2913+
staticbool
2914+
exec_eval_clear_fcache_walker(Node*node,void*context)
2915+
{
2916+
if (node==NULL)
2917+
return false;
2918+
if (IsA(node,Expr))
29162919
{
2917-
caseOP_EXPR:
2918-
((Oper*) (expr->oper))->op_fcache=NULL;
2919-
break;
2920+
Expr*expr= (Expr*)node;
29202921

2921-
caseFUNC_EXPR:
2922-
((Func*) (expr->oper))->func_fcache=NULL;
2923-
break;
2924-
2925-
default:
2926-
break;
2922+
switch (expr->opType)
2923+
{
2924+
caseOP_EXPR:
2925+
((Oper*) (expr->oper))->op_fcache=NULL;
2926+
break;
2927+
caseFUNC_EXPR:
2928+
((Func*) (expr->oper))->func_fcache=NULL;
2929+
break;
2930+
default:
2931+
break;
2932+
}
29272933
}
2928-
2929-
foreach(l,expr->args)
2930-
exec_eval_clear_fcache(lfirst(l));
2934+
returnexpression_tree_walker(node,exec_eval_clear_fcache_walker,
2935+
context);
29312936
}
29322937

2933-
29342938
/* ----------
29352939
* exec_set_foundSet the global found variable
29362940
*to true/false

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp