1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-06 07:49:08 +03:00

Get rid of some old and crufty global variables in the planner. When

this code was last gone over, there wasn't really any alternative to
globals because we didn't have the PlannerInfo struct being passed all
through the planner code.  Now that we do, we can restructure things
to avoid non-reentrancy.  I'm fooling with this because otherwise I'd
have had to add another global variable for the planned compact
range table list.
This commit is contained in:
Tom Lane
2007-02-19 07:03:34 +00:00
parent 90c301aaa9
commit 7c5e5439d2
18 changed files with 293 additions and 223 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.234 2007/02/16 23:32:08 tgl Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.235 2007/02/19 07:03:30 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -49,6 +49,7 @@
typedef struct
{
ParamListInfo boundParams;
List *active_fns;
Node *case_val;
bool estimate;
@@ -1578,6 +1579,7 @@ eval_const_expressions(Node *node)
{
eval_const_expressions_context context;
context.boundParams = NULL; /* don't use any bound params */
context.active_fns = NIL; /* nothing being recursively simplified */
context.case_val = NULL; /* no CASE being examined */
context.estimate = false; /* safe transformations only */
@@ -1601,10 +1603,11 @@ eval_const_expressions(Node *node)
*--------------------
*/
Node *
estimate_expression_value(Node *node)
estimate_expression_value(PlannerInfo *root, Node *node)
{
eval_const_expressions_context context;
context.boundParams = root->glob->boundParams; /* bound Params */
context.active_fns = NIL; /* nothing being recursively simplified */
context.case_val = NULL; /* no CASE being examined */
context.estimate = true; /* unsafe transformations OK */
@@ -1623,11 +1626,11 @@ eval_const_expressions_mutator(Node *node,
/* Look to see if we've been given a value for this Param */
if (param->paramkind == PARAM_EXTERN &&
PlannerBoundParamList != NULL &&
context->boundParams != NULL &&
param->paramid > 0 &&
param->paramid <= PlannerBoundParamList->numParams)
param->paramid <= context->boundParams->numParams)
{
ParamExternData *prm = &PlannerBoundParamList->params[param->paramid - 1];
ParamExternData *prm = &context->boundParams->params[param->paramid - 1];
if (OidIsValid(prm->ptype))
{