diff options
Diffstat (limited to 'src/backend/executor/execQual.c')
-rw-r--r-- | src/backend/executor/execQual.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c index fc16cccdda9..4c6f95a9a6f 100644 --- a/src/backend/executor/execQual.c +++ b/src/backend/executor/execQual.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.156 2004/03/17 20:48:42 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.157 2004/03/24 22:40:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,6 +27,11 @@ * trying to speed it up, the execution plan should be pre-processed * to facilitate attribute sharing between nodes wherever possible, * instead of doing needless copying. -cim 5/31/91 + * + * During expression evaluation, we check_stack_depth only in + * ExecMakeFunctionResult rather than at every single node. This + * is a compromise that trades off precision of the stack limit setting + * to gain speed. */ #include "postgres.h" @@ -840,6 +845,9 @@ ExecMakeFunctionResult(FuncExprState *fcache, bool hasSetArg; int i; + /* Guard against stack overflow due to overly complex expressions */ + check_stack_depth(); + /* * arguments is a list of expressions to evaluate before passing to * the function manager. We skip the evaluation if it was already @@ -1058,6 +1066,9 @@ ExecMakeFunctionResultNoSets(FuncExprState *fcache, FunctionCallInfoData fcinfo; int i; + /* Guard against stack overflow due to overly complex expressions */ + check_stack_depth(); + if (isDone) *isDone = ExprSingleResult; @@ -2503,6 +2514,10 @@ ExecInitExpr(Expr *node, PlanState *parent) if (node == NULL) return NULL; + + /* Guard against stack overflow due to overly complex expressions */ + check_stack_depth(); + switch (nodeTag(node)) { case T_Var: |