mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
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.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.275 2007/01/25 02:17:26 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.276 2007/02/20 17:32:13 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -986,10 +986,11 @@ DoCopy(const CopyStmt *stmt)
|
||||
{
|
||||
Query *query = stmt->query;
|
||||
List *rewritten;
|
||||
Plan *plan;
|
||||
PlannedStmt *plan;
|
||||
DestReceiver *dest;
|
||||
|
||||
Assert(query);
|
||||
Assert(query->commandType == CMD_SELECT);
|
||||
Assert(!is_from);
|
||||
cstate->rel = NULL;
|
||||
|
||||
@ -999,6 +1000,7 @@ DoCopy(const CopyStmt *stmt)
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("COPY (SELECT) WITH OIDS is not supported")));
|
||||
|
||||
/* Query mustn't use INTO, either */
|
||||
if (query->into)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
@ -1016,7 +1018,6 @@ DoCopy(const CopyStmt *stmt)
|
||||
* shouldn't modify its input ... FIXME someday.
|
||||
*/
|
||||
query = copyObject(query);
|
||||
Assert(query->commandType == CMD_SELECT);
|
||||
|
||||
/*
|
||||
* Must acquire locks in case we didn't come fresh from the parser.
|
||||
@ -1051,7 +1052,7 @@ DoCopy(const CopyStmt *stmt)
|
||||
((DR_copy *) dest)->cstate = cstate;
|
||||
|
||||
/* Create a QueryDesc requesting no output */
|
||||
cstate->queryDesc = CreateQueryDesc(query, plan,
|
||||
cstate->queryDesc = CreateQueryDesc(plan,
|
||||
ActiveSnapshot, InvalidSnapshot,
|
||||
dest, NULL, false);
|
||||
|
||||
|
Reference in New Issue
Block a user