|
3 | 3 | * procedural language
|
4 | 4 | *
|
5 | 5 | * 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 $ |
7 | 7 | *
|
8 | 8 | * This software is copyrighted by Jan Wieck - Hamburg.
|
9 | 9 | *
|
|
54 | 54 | #include"executor/spi.h"
|
55 | 55 | #include"executor/spi_priv.h"
|
56 | 56 | #include"fmgr.h"
|
| 57 | +#include"optimizer/clauses.h" |
57 | 58 | #include"parser/parse_expr.h"
|
58 | 59 | #include"tcop/tcopprot.h"
|
59 | 60 | #include"utils/builtins.h"
|
@@ -112,6 +113,7 @@ static void exec_prepare_plan(PLpgSQL_execstate * estate,
|
112 | 113 | staticboolexec_simple_check_node(Node*node);
|
113 | 114 | staticvoidexec_simple_check_plan(PLpgSQL_expr*expr);
|
114 | 115 | staticvoidexec_eval_clear_fcache(Node*node);
|
| 116 | +staticboolexec_eval_clear_fcache_walker(Node*node,void*context); |
115 | 117 | staticDatumexec_eval_simple_expr(PLpgSQL_execstate*estate,
|
116 | 118 | PLpgSQL_expr*expr,
|
117 | 119 | bool*isNull,
|
@@ -2593,7 +2595,7 @@ exec_eval_simple_expr(PLpgSQL_execstate * estate,
|
2593 | 2595 | *rettype=expr->plan_simple_type;
|
2594 | 2596 |
|
2595 | 2597 | /* ----------
|
2596 |
| - * Clearthe function cache |
| 2598 | + * Clearany function cache entries in the expression tree |
2597 | 2599 | * ----------
|
2598 | 2600 | */
|
2599 | 2601 | exec_eval_clear_fcache(expr->plan_simple_expr);
|
@@ -2904,33 +2906,35 @@ exec_simple_check_plan(PLpgSQL_expr * expr)
|
2904 | 2906 | staticvoid
|
2905 | 2907 | exec_eval_clear_fcache(Node*node)
|
2906 | 2908 | {
|
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 | +} |
2914 | 2912 |
|
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)) |
2916 | 2919 | {
|
2917 |
| -caseOP_EXPR: |
2918 |
| -((Oper*) (expr->oper))->op_fcache=NULL; |
2919 |
| -break; |
| 2920 | +Expr*expr= (Expr*)node; |
2920 | 2921 |
|
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 | +} |
2927 | 2933 | }
|
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); |
2931 | 2936 | }
|
2932 | 2937 |
|
2933 |
| - |
2934 | 2938 | /* ----------
|
2935 | 2939 | * exec_set_foundSet the global found variable
|
2936 | 2940 | *to true/false
|
|