1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-22 21:53:06 +03:00

Adjust handling of command status strings in the presence of rules,

as per recent pghackers discussions.  initdb forced due to change in
fields of stored Query nodes.
This commit is contained in:
Tom Lane
2002-10-14 22:14:35 +00:00
parent ea3728ee5b
commit d508b057ac
10 changed files with 184 additions and 62 deletions

View File

@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.213 2002/09/22 19:42:51 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.214 2002/10/14 22:14:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1778,6 +1778,7 @@ _copyQuery(Query *from)
Query *newnode = makeNode(Query);
newnode->commandType = from->commandType;
newnode->querySource = from->querySource;
Node_Copy(from, newnode, utilityStmt);
newnode->resultRelation = from->resultRelation;
Node_Copy(from, newnode, into);
@@ -1785,7 +1786,6 @@ _copyQuery(Query *from)
newnode->isBinary = from->isBinary;
newnode->hasAggs = from->hasAggs;
newnode->hasSubLinks = from->hasSubLinks;
newnode->originalQuery = from->originalQuery;
Node_Copy(from, newnode, rtable);
Node_Copy(from, newnode, jointree);

View File

@@ -20,7 +20,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.160 2002/09/22 19:42:51 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.161 2002/10/14 22:14:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -573,6 +573,8 @@ _equalQuery(Query *a, Query *b)
{
if (a->commandType != b->commandType)
return false;
if (a->querySource != b->querySource)
return false;
if (!equal(a->utilityStmt, b->utilityStmt))
return false;
if (a->resultRelation != b->resultRelation)
@@ -587,7 +589,6 @@ _equalQuery(Query *a, Query *b)
return false;
if (a->hasSubLinks != b->hasSubLinks)
return false;
/* we deliberately ignore originalQuery */
if (!equal(a->rtable, b->rtable))
return false;
if (!equal(a->jointree, b->jointree))

View File

@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.175 2002/09/22 19:42:51 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.176 2002/10/14 22:14:34 tgl Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -229,7 +229,8 @@ _outIndexElem(StringInfo str, IndexElem *node)
static void
_outQuery(StringInfo str, Query *node)
{
appendStringInfo(str, " QUERY :command %d :utility ", node->commandType);
appendStringInfo(str, " QUERY :command %d :source %d :utility ",
(int) node->commandType, (int) node->querySource);
/*
* Hack to work around missing outfuncs routines for a lot of the
@@ -299,6 +300,8 @@ _outQuery(StringInfo str, Query *node)
appendStringInfo(str, " :resultRelations ");
_outIntList(str, node->resultRelations);
/* planner-internal fields are not written out */
}
static void

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.134 2002/09/22 19:42:51 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.135 2002/10/14 22:14:34 tgl Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
@@ -123,6 +123,10 @@ _readQuery(void)
token = pg_strtok(&length); /* get commandType */
local_node->commandType = atoi(token);
token = pg_strtok(&length); /* skip :source */
token = pg_strtok(&length); /* get querySource */
local_node->querySource = atoi(token);
token = pg_strtok(&length); /* skip :utility */
local_node->utilityStmt = nodeRead(true);
@@ -149,9 +153,6 @@ _readQuery(void)
token = pg_strtok(&length); /* get hasSubLinks */
local_node->hasSubLinks = strtobool(token);
/* we always want originalQuery to be false in a read-in query */
local_node->originalQuery = false;
token = pg_strtok(&length); /* skip :rtable */
local_node->rtable = nodeRead(true);
@@ -188,6 +189,8 @@ _readQuery(void)
token = pg_strtok(&length); /* skip :resultRelations */
local_node->resultRelations = toIntList(nodeRead(true));
/* planner-internal fields are left zero */
return local_node;
}