From 9cbd0c155d1602aad879f510256b626c58942080 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 20 Feb 2007 17:32:18 +0000 Subject: Remove the Query structure from the executor's API. This allows us to stop storing mostly-redundant Query trees in prepared statements, portals, etc. To replace Query, a new node type called PlannedStmt is inserted by the planner at the top of a completed plan tree; this carries just the fields of Query that are still needed at runtime. The statement lists kept in portals etc. now consist of intermixed PlannedStmt and bare utility-statement nodes --- no Query. This incidentally allows us to remove some fields from Query and Plan nodes that shouldn't have been there in the first place. Still to do: simplify the execution-time range table; at the moment the range table passed to the executor still contains Query trees for subqueries. initdb forced due to change of stored rules. --- src/backend/commands/explain.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/backend/commands/explain.c') diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 7b2c521a35..58b7e6ded9 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994-5, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.155 2007/02/19 02:23:11 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.156 2007/02/20 17:32:14 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -149,7 +149,7 @@ static void ExplainOneQuery(Query *query, ExplainStmt *stmt, ParamListInfo params, TupOutputState *tstate) { - Plan *plan; + PlannedStmt *plan; QueryDesc *queryDesc; bool isCursor = false; int cursorOptions = 0; @@ -203,7 +203,7 @@ ExplainOneQuery(Query *query, ExplainStmt *stmt, ParamListInfo params, ActiveSnapshot->curcid = GetCurrentCommandId(); /* Create a QueryDesc requesting no output */ - queryDesc = CreateQueryDesc(query, plan, + queryDesc = CreateQueryDesc(plan, ActiveSnapshot, InvalidSnapshot, None_Receiver, params, stmt->analyze); @@ -260,14 +260,14 @@ ExplainOnePlan(QueryDesc *queryDesc, ExplainStmt *stmt, es->printNodes = stmt->verbose; es->printAnalyze = stmt->analyze; - es->rtable = queryDesc->parsetree->rtable; + es->rtable = queryDesc->plannedstmt->rtable; if (es->printNodes) { char *s; char *f; - s = nodeToString(queryDesc->plantree); + s = nodeToString(queryDesc->plannedstmt->planTree); if (s) { if (Explain_pretty_print) @@ -282,7 +282,8 @@ ExplainOnePlan(QueryDesc *queryDesc, ExplainStmt *stmt, } initStringInfo(&buf); - explain_outNode(&buf, queryDesc->plantree, queryDesc->planstate, + explain_outNode(&buf, + queryDesc->plannedstmt->planTree, queryDesc->planstate, NULL, 0, es); /* -- cgit v1.2.1