From 7c5e5439d2a64ee82d54be2e064a4bb4602bad30 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 19 Feb 2007 07:03:34 +0000 Subject: 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. --- src/backend/nodes/outfuncs.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'src/backend/nodes/outfuncs.c') diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index a173cf59dff..0600f63b556 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.298 2007/02/19 02:23:12 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.299 2007/02/19 07:03:27 tgl Exp $ * * NOTES * Every node type that can appear in stored rules' parsetrees *must* @@ -1225,6 +1225,16 @@ _outHashPath(StringInfo str, HashPath *node) WRITE_NODE_FIELD(path_hashclauses); } +static void +_outPlannerGlobal(StringInfo str, PlannerGlobal *node) +{ + WRITE_NODE_TYPE("PLANNERGLOBAL"); + + /* NB: this isn't a complete set of fields */ + WRITE_NODE_FIELD(paramlist); + WRITE_INT_FIELD(next_plan_id); +} + static void _outPlannerInfo(StringInfo str, PlannerInfo *node) { @@ -1232,7 +1242,10 @@ _outPlannerInfo(StringInfo str, PlannerInfo *node) /* NB: this isn't a complete set of fields */ WRITE_NODE_FIELD(parse); + WRITE_NODE_FIELD(glob); + WRITE_UINT_FIELD(query_level); WRITE_NODE_FIELD(join_rel_list); + WRITE_NODE_FIELD(init_plans); WRITE_NODE_FIELD(eq_classes); WRITE_NODE_FIELD(canon_pathkeys); WRITE_NODE_FIELD(left_join_clauses); @@ -1416,6 +1429,15 @@ _outAppendRelInfo(StringInfo str, AppendRelInfo *node) WRITE_OID_FIELD(parent_reloid); } +static void +_outPlannerParamItem(StringInfo str, PlannerParamItem *node) +{ + WRITE_NODE_TYPE("PLANNERPARAMITEM"); + + WRITE_NODE_FIELD(item); + WRITE_UINT_FIELD(abslevel); +} + /***************************************************************************** * * Stuff from parsenodes.h. @@ -2195,6 +2217,9 @@ _outNode(StringInfo str, void *obj) case T_HashPath: _outHashPath(str, obj); break; + case T_PlannerGlobal: + _outPlannerGlobal(str, obj); + break; case T_PlannerInfo: _outPlannerInfo(str, obj); break; @@ -2228,6 +2253,9 @@ _outNode(StringInfo str, void *obj) case T_AppendRelInfo: _outAppendRelInfo(str, obj); break; + case T_PlannerParamItem: + _outPlannerParamItem(str, obj); + break; case T_CreateStmt: _outCreateStmt(str, obj); -- cgit v1.2.3