summaryrefslogtreecommitdiff
path: root/src/include/commands
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-02-20 17:32:18 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-02-20 17:32:18 +0000
commit9cbd0c155d1602aad879f510256b626c58942080 (patch)
tree6d5504a4e841313d3a29cead80067006dc408e39 /src/include/commands
parent71b0cf2f6bec3129f2c3f574d4e47408c2dc2516 (diff)
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.
Diffstat (limited to 'src/include/commands')
-rw-r--r--src/include/commands/portalcmds.h3
-rw-r--r--src/include/commands/prepare.h16
2 files changed, 12 insertions, 7 deletions
diff --git a/src/include/commands/portalcmds.h b/src/include/commands/portalcmds.h
index 4a17ddb767a..50fe2f13284 100644
--- a/src/include/commands/portalcmds.h
+++ b/src/include/commands/portalcmds.h
@@ -7,13 +7,14 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/commands/portalcmds.h,v 1.20 2007/01/05 22:19:53 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/commands/portalcmds.h,v 1.21 2007/02/20 17:32:17 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PORTALCMDS_H
#define PORTALCMDS_H
+#include "nodes/parsenodes.h"
#include "utils/portal.h"
diff --git a/src/include/commands/prepare.h b/src/include/commands/prepare.h
index c1ee47fe7e8..a921bf1b045 100644
--- a/src/include/commands/prepare.h
+++ b/src/include/commands/prepare.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 2002-2007, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/include/commands/prepare.h,v 1.23 2007/01/05 22:19:53 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/commands/prepare.h,v 1.24 2007/02/20 17:32:17 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,6 +19,10 @@
/*
* The data structure representing a prepared statement
*
+ * A prepared statement might be fully planned, or only parsed-and-rewritten.
+ * If fully planned, stmt_list contains PlannedStmts and/or utility statements;
+ * if not, it contains Query nodes.
+ *
* Note: all subsidiary storage lives in the context denoted by the context
* field. However, the string referenced by commandTag is not subsidiary
* storage; it is assumed to be a compile-time-constant string. As with
@@ -31,11 +35,11 @@ typedef struct
char stmt_name[NAMEDATALEN];
char *query_string; /* text of query, or NULL */
const char *commandTag; /* command tag (a constant!), or NULL */
- List *query_list; /* list of queries, rewritten */
- List *plan_list; /* list of plans */
+ List *stmt_list; /* list of statement or Query nodes */
List *argtype_list; /* list of parameter type OIDs */
+ bool fully_planned; /* what is in stmt_list, exactly? */
+ bool from_sql; /* prepared via SQL, not FE/BE protocol? */
TimestampTz prepare_time; /* the time when the stmt was prepared */
- bool from_sql; /* stmt prepared via SQL, not FE/BE protocol? */
MemoryContext context; /* context containing this query */
} PreparedStatement;
@@ -52,9 +56,9 @@ extern void ExplainExecuteQuery(ExplainStmt *stmt, ParamListInfo params,
extern void StorePreparedStatement(const char *stmt_name,
const char *query_string,
const char *commandTag,
- List *query_list,
- List *plan_list,
+ List *stmt_list,
List *argtype_list,
+ bool fully_planned,
bool from_sql);
extern PreparedStatement *FetchPreparedStatement(const char *stmt_name,
bool throwError);