1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-24 09:27:52 +03:00

First phase of SCHEMA changes, concentrating on fixing the grammar and

the parsetree representation.  As yet we don't *do* anything with schema
names, just drop 'em on the floor; but you can enter schema-compatible
command syntax, and there's even a primitive CREATE SCHEMA command.
No doc updates yet, except to note that you can now extract a field
from a function-returning-row's result with (foo(...)).fieldname.
This commit is contained in:
Tom Lane
2002-03-21 16:02:16 +00:00
parent 8c9c8ca2b5
commit 95ef6a3448
52 changed files with 2039 additions and 1535 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.171 2002/03/20 19:43:58 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.172 2002/03/21 16:00:39 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -733,18 +733,6 @@ _copyVar(Var *from)
return newnode;
}
static Attr *
_copyAttr(Attr *from)
{
Attr *newnode = makeNode(Attr);
if (from->relname)
newnode->relname = pstrdup(from->relname);
Node_Copy(from, newnode, attrs);
return newnode;
}
/* ----------------
* _copyOper
* ----------------
@@ -1515,8 +1503,7 @@ _copyFkConstraint(FkConstraint *from)
if (from->constr_name)
newnode->constr_name = pstrdup(from->constr_name);
if (from->pktable_name)
newnode->pktable_name = pstrdup(from->pktable_name);
Node_Copy(from, newnode, pktable);
Node_Copy(from, newnode, fk_attrs);
Node_Copy(from, newnode, pk_attrs);
if (from->match_type)
@@ -1553,6 +1540,29 @@ _copyAExpr(A_Expr *from)
return newnode;
}
static ColumnRef *
_copyColumnRef(ColumnRef *from)
{
ColumnRef *newnode = makeNode(ColumnRef);
Node_Copy(from, newnode, fields);
Node_Copy(from, newnode, indirection);
return newnode;
}
static ParamRef *
_copyParamRef(ParamRef *from)
{
ParamRef *newnode = makeNode(ParamRef);
newnode->number = from->number;
Node_Copy(from, newnode, fields);
Node_Copy(from, newnode, indirection);
return newnode;
}
static A_Const *
_copyAConst(A_Const *from)
{
@@ -1564,27 +1574,12 @@ _copyAConst(A_Const *from)
return newnode;
}
static ParamNo *
_copyParamNo(ParamNo *from)
{
ParamNo *newnode = makeNode(ParamNo);
newnode->number = from->number;
Node_Copy(from, newnode, typename);
Node_Copy(from, newnode, indirection);
return newnode;
}
static Ident *
_copyIdent(Ident *from)
{
Ident *newnode = makeNode(Ident);
if (from->name)
newnode->name = pstrdup(from->name);
Node_Copy(from, newnode, indirection);
newnode->isRel = from->isRel;
newnode->name = pstrdup(from->name);
return newnode;
}
@@ -1614,6 +1609,18 @@ _copyAIndices(A_Indices *from)
return newnode;
}
static ExprFieldSelect *
_copyExprFieldSelect(ExprFieldSelect *from)
{
ExprFieldSelect *newnode = makeNode(ExprFieldSelect);
Node_Copy(from, newnode, arg);
Node_Copy(from, newnode, fields);
Node_Copy(from, newnode, indirection);
return newnode;
}
static ResTarget *
_copyResTarget(ResTarget *from)
{
@@ -1654,15 +1661,32 @@ _copySortGroupBy(SortGroupBy *from)
return newnode;
}
static Alias *
_copyAlias(Alias *from)
{
Alias *newnode = makeNode(Alias);
if (from->aliasname)
newnode->aliasname = pstrdup(from->aliasname);
Node_Copy(from, newnode, colnames);
return newnode;
}
static RangeVar *
_copyRangeVar(RangeVar *from)
{
RangeVar *newnode = makeNode(RangeVar);
if (from->catalogname)
newnode->catalogname = pstrdup(from->catalogname);
if (from->schemaname)
newnode->schemaname = pstrdup(from->schemaname);
if (from->relname)
newnode->relname = pstrdup(from->relname);
newnode->inhOpt = from->inhOpt;
Node_Copy(from, newnode, name);
newnode->istemp = from->istemp;
Node_Copy(from, newnode, alias);
return newnode;
}
@@ -1673,7 +1697,7 @@ _copyRangeSubselect(RangeSubselect *from)
RangeSubselect *newnode = makeNode(RangeSubselect);
Node_Copy(from, newnode, subquery);
Node_Copy(from, newnode, name);
Node_Copy(from, newnode, alias);
return newnode;
}
@@ -1756,11 +1780,9 @@ _copyQuery(Query *from)
newnode->commandType = from->commandType;
Node_Copy(from, newnode, utilityStmt);
newnode->resultRelation = from->resultRelation;
if (from->into)
newnode->into = pstrdup(from->into);
Node_Copy(from, newnode, into);
newnode->isPortal = from->isPortal;
newnode->isBinary = from->isBinary;
newnode->isTemp = from->isTemp;
newnode->hasAggs = from->hasAggs;
newnode->hasSubLinks = from->hasSubLinks;
newnode->originalQuery = from->originalQuery;
@@ -1798,8 +1820,7 @@ _copyInsertStmt(InsertStmt *from)
{
InsertStmt *newnode = makeNode(InsertStmt);
if (from->relname)
newnode->relname = pstrdup(from->relname);
Node_Copy(from, newnode, relation);
Node_Copy(from, newnode, cols);
Node_Copy(from, newnode, targetList);
Node_Copy(from, newnode, selectStmt);
@@ -1812,10 +1833,8 @@ _copyDeleteStmt(DeleteStmt *from)
{
DeleteStmt *newnode = makeNode(DeleteStmt);
if (from->relname)
newnode->relname = pstrdup(from->relname);
Node_Copy(from, newnode, relation);
Node_Copy(from, newnode, whereClause);
newnode->inhOpt = from->inhOpt;
return newnode;
}
@@ -1825,12 +1844,10 @@ _copyUpdateStmt(UpdateStmt *from)
{
UpdateStmt *newnode = makeNode(UpdateStmt);
if (from->relname)
newnode->relname = pstrdup(from->relname);
Node_Copy(from, newnode, relation);
Node_Copy(from, newnode, targetList);
Node_Copy(from, newnode, whereClause);
Node_Copy(from, newnode, fromClause);
newnode->inhOpt = from->inhOpt;
return newnode;
}
@@ -1841,9 +1858,7 @@ _copySelectStmt(SelectStmt *from)
SelectStmt *newnode = makeNode(SelectStmt);
Node_Copy(from, newnode, distinctClause);
if (from->into)
newnode->into = pstrdup(from->into);
newnode->istemp = from->istemp;
Node_Copy(from, newnode, into);
Node_Copy(from, newnode, intoColNames);
Node_Copy(from, newnode, targetList);
Node_Copy(from, newnode, fromClause);
@@ -1885,9 +1900,7 @@ _copyAlterTableStmt(AlterTableStmt *from)
AlterTableStmt *newnode = makeNode(AlterTableStmt);
newnode->subtype = from->subtype;
if (from->relname)
newnode->relname = pstrdup(from->relname);
newnode->inhOpt = from->inhOpt;
Node_Copy(from, newnode, relation);
if (from->name)
newnode->name = pstrdup(from->name);
Node_Copy(from, newnode, def);
@@ -1951,8 +1964,7 @@ _copyClusterStmt(ClusterStmt *from)
{
ClusterStmt *newnode = makeNode(ClusterStmt);
if (from->relname)
newnode->relname = pstrdup(from->relname);
Node_Copy(from, newnode, relation);
if (from->indexname)
newnode->indexname = pstrdup(from->indexname);
@@ -1965,8 +1977,7 @@ _copyCopyStmt(CopyStmt *from)
CopyStmt *newnode = makeNode(CopyStmt);
newnode->binary = from->binary;
if (from->relname)
newnode->relname = pstrdup(from->relname);
Node_Copy(from, newnode, relation);
newnode->oids = from->oids;
newnode->direction = from->direction;
if (from->filename)
@@ -1984,11 +1995,10 @@ _copyCreateStmt(CreateStmt *from)
{
CreateStmt *newnode = makeNode(CreateStmt);
newnode->relname = pstrdup(from->relname);
Node_Copy(from, newnode, relation);
Node_Copy(from, newnode, tableElts);
Node_Copy(from, newnode, inhRelnames);
Node_Copy(from, newnode, inhRelations);
Node_Copy(from, newnode, constraints);
newnode->istemp = from->istemp;
newnode->hasoids = from->hasoids;
return newnode;
@@ -2024,7 +2034,7 @@ _copyDropStmt(DropStmt *from)
{
DropStmt *newnode = makeNode(DropStmt);
Node_Copy(from, newnode, names);
Node_Copy(from, newnode, objects);
newnode->removeType = from->removeType;
newnode->behavior = from->behavior;
@@ -2036,7 +2046,7 @@ _copyTruncateStmt(TruncateStmt *from)
{
TruncateStmt *newnode = makeNode(TruncateStmt);
newnode->relName = pstrdup(from->relName);
Node_Copy(from, newnode, relation);
return newnode;
}
@@ -2047,6 +2057,8 @@ _copyCommentStmt(CommentStmt *from)
CommentStmt *newnode = makeNode(CommentStmt);
newnode->objtype = from->objtype;
if (from->objschema)
newnode->objschema = pstrdup(from->objschema);
newnode->objname = pstrdup(from->objname);
if (from->objproperty)
newnode->objproperty = pstrdup(from->objproperty);
@@ -2075,7 +2087,7 @@ _copyIndexStmt(IndexStmt *from)
IndexStmt *newnode = makeNode(IndexStmt);
newnode->idxname = pstrdup(from->idxname);
newnode->relname = pstrdup(from->relname);
Node_Copy(from, newnode, relation);
newnode->accessMethod = pstrdup(from->accessMethod);
Node_Copy(from, newnode, indexParams);
Node_Copy(from, newnode, whereClause);
@@ -2140,8 +2152,7 @@ _copyRenameStmt(RenameStmt *from)
{
RenameStmt *newnode = makeNode(RenameStmt);
newnode->relname = pstrdup(from->relname);
newnode->inhOpt = from->inhOpt;
Node_Copy(from, newnode, relation);
if (from->column)
newnode->column = pstrdup(from->column);
if (from->newname)
@@ -2155,10 +2166,10 @@ _copyRuleStmt(RuleStmt *from)
{
RuleStmt *newnode = makeNode(RuleStmt);
Node_Copy(from, newnode, relation);
newnode->rulename = pstrdup(from->rulename);
Node_Copy(from, newnode, whereClause);
newnode->event = from->event;
Node_Copy(from, newnode, object);
newnode->instead = from->instead;
Node_Copy(from, newnode, actions);
@@ -2170,8 +2181,7 @@ _copyNotifyStmt(NotifyStmt *from)
{
NotifyStmt *newnode = makeNode(NotifyStmt);
if (from->relname)
newnode->relname = pstrdup(from->relname);
Node_Copy(from, newnode, relation);
return newnode;
}
@@ -2181,8 +2191,7 @@ _copyListenStmt(ListenStmt *from)
{
ListenStmt *newnode = makeNode(ListenStmt);
if (from->relname)
newnode->relname = pstrdup(from->relname);
Node_Copy(from, newnode, relation);
return newnode;
}
@@ -2192,8 +2201,7 @@ _copyUnlistenStmt(UnlistenStmt *from)
{
UnlistenStmt *newnode = makeNode(UnlistenStmt);
if (from->relname)
newnode->relname = pstrdup(from->relname);
Node_Copy(from, newnode, relation);
return newnode;
}
@@ -2213,8 +2221,7 @@ _copyViewStmt(ViewStmt *from)
{
ViewStmt *newnode = makeNode(ViewStmt);
if (from->viewname)
newnode->viewname = pstrdup(from->viewname);
Node_Copy(from, newnode, view);
Node_Copy(from, newnode, aliases);
Node_Copy(from, newnode, query);
@@ -2298,8 +2305,7 @@ _copyVacuumStmt(VacuumStmt *from)
newnode->analyze = from->analyze;
newnode->freeze = from->freeze;
newnode->verbose = from->verbose;
if (from->vacrel)
newnode->vacrel = pstrdup(from->vacrel);
Node_Copy(from, newnode, relation);
Node_Copy(from, newnode, va_cols);
return newnode;
@@ -2322,8 +2328,7 @@ _copyCreateSeqStmt(CreateSeqStmt *from)
{
CreateSeqStmt *newnode = makeNode(CreateSeqStmt);
if (from->seqname)
newnode->seqname = pstrdup(from->seqname);
Node_Copy(from, newnode, sequence);
Node_Copy(from, newnode, options);
return newnode;
@@ -2370,8 +2375,7 @@ _copyCreateTrigStmt(CreateTrigStmt *from)
if (from->trigname)
newnode->trigname = pstrdup(from->trigname);
if (from->relname)
newnode->relname = pstrdup(from->relname);
Node_Copy(from, newnode, relation);
if (from->funcname)
newnode->funcname = pstrdup(from->funcname);
Node_Copy(from, newnode, args);
@@ -2389,8 +2393,7 @@ _copyCreateTrigStmt(CreateTrigStmt *from)
newnode->isconstraint = from->isconstraint;
newnode->deferrable = from->deferrable;
newnode->initdeferred = from->initdeferred;
if (from->constrrelname)
newnode->constrrelname = pstrdup(from->constrrelname);
Node_Copy(from, newnode, constrrel);
return newnode;
}
@@ -2402,8 +2405,7 @@ _copyDropTrigStmt(DropTrigStmt *from)
if (from->trigname)
newnode->trigname = pstrdup(from->trigname);
if (from->relname)
newnode->relname = pstrdup(from->relname);
Node_Copy(from, newnode, relation);
return newnode;
}
@@ -2488,7 +2490,7 @@ _copyLockStmt(LockStmt *from)
{
LockStmt *newnode = makeNode(LockStmt);
Node_Copy(from, newnode, rellist);
Node_Copy(from, newnode, relations);
newnode->mode = from->mode;
@@ -2548,6 +2550,7 @@ _copyReindexStmt(ReindexStmt *from)
ReindexStmt *newnode = makeNode(ReindexStmt);
newnode->reindexType = from->reindexType;
Node_Copy(from, newnode, relation);
if (from->name)
newnode->name = pstrdup(from->name);
newnode->force = from->force;
@@ -2556,6 +2559,19 @@ _copyReindexStmt(ReindexStmt *from)
return newnode;
}
static CreateSchemaStmt *
_copyCreateSchemaStmt(CreateSchemaStmt *from)
{
CreateSchemaStmt *newnode = makeNode(CreateSchemaStmt);
newnode->schemaname = pstrdup(from->schemaname);
if (from->authid)
newnode->authid = pstrdup(from->authid);
Node_Copy(from, newnode, schemaElts);
return newnode;
}
/* ****************************************************************
* pg_list.h copy functions
@@ -2888,6 +2904,9 @@ copyObject(void *from)
case T_LoadStmt:
retval = _copyLoadStmt(from);
break;
case T_CreateDomainStmt:
retval = _copyCreateDomainStmt(from);
break;
case T_CreatedbStmt:
retval = _copyCreatedbStmt(from);
break;
@@ -2960,19 +2979,22 @@ copyObject(void *from)
case T_CheckPointStmt:
retval = (void *) makeNode(CheckPointStmt);
break;
case T_CreateSchemaStmt:
retval = _copyCreateSchemaStmt(from);
break;
case T_A_Expr:
retval = _copyAExpr(from);
break;
case T_Attr:
retval = _copyAttr(from);
case T_ColumnRef:
retval = _copyColumnRef(from);
break;
case T_ParamRef:
retval = _copyParamRef(from);
break;
case T_A_Const:
retval = _copyAConst(from);
break;
case T_ParamNo:
retval = _copyParamNo(from);
break;
case T_Ident:
retval = _copyIdent(from);
break;
@@ -2982,6 +3004,9 @@ copyObject(void *from)
case T_A_Indices:
retval = _copyAIndices(from);
break;
case T_ExprFieldSelect:
retval = _copyExprFieldSelect(from);
break;
case T_ResTarget:
retval = _copyResTarget(from);
break;
@@ -2991,6 +3016,9 @@ copyObject(void *from)
case T_SortGroupBy:
retval = _copySortGroupBy(from);
break;
case T_Alias:
retval = _copyAlias(from);
break;
case T_RangeVar:
retval = _copyRangeVar(from);
break;
@@ -3045,9 +3073,6 @@ copyObject(void *from)
case T_FuncWithArgs:
retval = _copyFuncWithArgs(from);
break;
case T_CreateDomainStmt:
retval = _copyCreateDomainStmt(from);
break;
default:
elog(ERROR, "copyObject: don't know how to copy node type %d",

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.119 2002/03/20 19:44:01 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.120 2002/03/21 16:00:39 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -579,14 +579,12 @@ _equalQuery(Query *a, Query *b)
return false;
if (a->resultRelation != b->resultRelation)
return false;
if (!equalstr(a->into, b->into))
if (!equal(a->into, b->into))
return false;
if (a->isPortal != b->isPortal)
return false;
if (a->isBinary != b->isBinary)
return false;
if (a->isTemp != b->isTemp)
return false;
if (a->hasAggs != b->hasAggs)
return false;
if (a->hasSubLinks != b->hasSubLinks)
@@ -629,7 +627,7 @@ _equalQuery(Query *a, Query *b)
static bool
_equalInsertStmt(InsertStmt *a, InsertStmt *b)
{
if (!equalstr(a->relname, b->relname))
if (!equal(a->relation, b->relation))
return false;
if (!equal(a->cols, b->cols))
return false;
@@ -644,12 +642,10 @@ _equalInsertStmt(InsertStmt *a, InsertStmt *b)
static bool
_equalDeleteStmt(DeleteStmt *a, DeleteStmt *b)
{
if (!equalstr(a->relname, b->relname))
if (!equal(a->relation, b->relation))
return false;
if (!equal(a->whereClause, b->whereClause))
return false;
if (a->inhOpt != b->inhOpt)
return false;
return true;
}
@@ -657,7 +653,7 @@ _equalDeleteStmt(DeleteStmt *a, DeleteStmt *b)
static bool
_equalUpdateStmt(UpdateStmt *a, UpdateStmt *b)
{
if (!equalstr(a->relname, b->relname))
if (!equal(a->relation, b->relation))
return false;
if (!equal(a->targetList, b->targetList))
return false;
@@ -665,8 +661,6 @@ _equalUpdateStmt(UpdateStmt *a, UpdateStmt *b)
return false;
if (!equal(a->fromClause, b->fromClause))
return false;
if (a->inhOpt != b->inhOpt)
return false;
return true;
}
@@ -676,9 +670,7 @@ _equalSelectStmt(SelectStmt *a, SelectStmt *b)
{
if (!equal(a->distinctClause, b->distinctClause))
return false;
if (!equalstr(a->into, b->into))
return false;
if (a->istemp != b->istemp)
if (!equal(a->into, b->into))
return false;
if (!equal(a->intoColNames, b->intoColNames))
return false;
@@ -738,9 +730,7 @@ _equalAlterTableStmt(AlterTableStmt *a, AlterTableStmt *b)
{
if (a->subtype != b->subtype)
return false;
if (!equalstr(a->relname, b->relname))
return false;
if (a->inhOpt != b->inhOpt)
if (!equal(a->relation, b->relation))
return false;
if (!equalstr(a->name, b->name))
return false;
@@ -795,7 +785,7 @@ _equalClosePortalStmt(ClosePortalStmt *a, ClosePortalStmt *b)
static bool
_equalClusterStmt(ClusterStmt *a, ClusterStmt *b)
{
if (!equalstr(a->relname, b->relname))
if (!equal(a->relation, b->relation))
return false;
if (!equalstr(a->indexname, b->indexname))
return false;
@@ -808,7 +798,7 @@ _equalCopyStmt(CopyStmt *a, CopyStmt *b)
{
if (a->binary != b->binary)
return false;
if (!equalstr(a->relname, b->relname))
if (!equal(a->relation, b->relation))
return false;
if (a->oids != b->oids)
return false;
@@ -827,16 +817,14 @@ _equalCopyStmt(CopyStmt *a, CopyStmt *b)
static bool
_equalCreateStmt(CreateStmt *a, CreateStmt *b)
{
if (!equalstr(a->relname, b->relname))
if (!equal(a->relation, b->relation))
return false;
if (!equal(a->tableElts, b->tableElts))
return false;
if (!equal(a->inhRelnames, b->inhRelnames))
if (!equal(a->inhRelations, b->inhRelations))
return false;
if (!equal(a->constraints, b->constraints))
return false;
if (a->istemp != b->istemp)
return false;
if (a->hasoids != b->hasoids)
return false;
@@ -874,7 +862,7 @@ _equalDefineStmt(DefineStmt *a, DefineStmt *b)
static bool
_equalDropStmt(DropStmt *a, DropStmt *b)
{
if (!equal(a->names, b->names))
if (!equal(a->objects, b->objects))
return false;
if (a->removeType != b->removeType)
return false;
@@ -887,7 +875,7 @@ _equalDropStmt(DropStmt *a, DropStmt *b)
static bool
_equalTruncateStmt(TruncateStmt *a, TruncateStmt *b)
{
if (!equalstr(a->relName, b->relName))
if (!equal(a->relation, b->relation))
return false;
return true;
@@ -900,6 +888,8 @@ _equalCommentStmt(CommentStmt *a, CommentStmt *b)
return false;
if (!equalstr(a->objname, b->objname))
return false;
if (!equalstr(a->objschema, b->objschema))
return false;
if (!equalstr(a->objproperty, b->objproperty))
return false;
if (!equal(a->objlist, b->objlist))
@@ -930,7 +920,7 @@ _equalIndexStmt(IndexStmt *a, IndexStmt *b)
{
if (!equalstr(a->idxname, b->idxname))
return false;
if (!equalstr(a->relname, b->relname))
if (!equal(a->relation, b->relation))
return false;
if (!equalstr(a->accessMethod, b->accessMethod))
return false;
@@ -1006,9 +996,7 @@ _equalRemoveOperStmt(RemoveOperStmt *a, RemoveOperStmt *b)
static bool
_equalRenameStmt(RenameStmt *a, RenameStmt *b)
{
if (!equalstr(a->relname, b->relname))
return false;
if (a->inhOpt != b->inhOpt)
if (!equal(a->relation, b->relation))
return false;
if (!equalstr(a->column, b->column))
return false;
@@ -1021,14 +1009,14 @@ _equalRenameStmt(RenameStmt *a, RenameStmt *b)
static bool
_equalRuleStmt(RuleStmt *a, RuleStmt *b)
{
if (!equal(a->relation, b->relation))
return false;
if (!equalstr(a->rulename, b->rulename))
return false;
if (!equal(a->whereClause, b->whereClause))
return false;
if (a->event != b->event)
return false;
if (!equal(a->object, b->object))
return false;
if (a->instead != b->instead)
return false;
if (!equal(a->actions, b->actions))
@@ -1040,7 +1028,7 @@ _equalRuleStmt(RuleStmt *a, RuleStmt *b)
static bool
_equalNotifyStmt(NotifyStmt *a, NotifyStmt *b)
{
if (!equalstr(a->relname, b->relname))
if (!equal(a->relation, b->relation))
return false;
return true;
@@ -1049,7 +1037,7 @@ _equalNotifyStmt(NotifyStmt *a, NotifyStmt *b)
static bool
_equalListenStmt(ListenStmt *a, ListenStmt *b)
{
if (!equalstr(a->relname, b->relname))
if (!equal(a->relation, b->relation))
return false;
return true;
@@ -1058,7 +1046,7 @@ _equalListenStmt(ListenStmt *a, ListenStmt *b)
static bool
_equalUnlistenStmt(UnlistenStmt *a, UnlistenStmt *b)
{
if (!equalstr(a->relname, b->relname))
if (!equal(a->relation, b->relation))
return false;
return true;
@@ -1076,7 +1064,7 @@ _equalTransactionStmt(TransactionStmt *a, TransactionStmt *b)
static bool
_equalViewStmt(ViewStmt *a, ViewStmt *b)
{
if (!equalstr(a->viewname, b->viewname))
if (!equal(a->view, b->view))
return false;
if (!equal(a->aliases, b->aliases))
return false;
@@ -1160,7 +1148,7 @@ _equalVacuumStmt(VacuumStmt *a, VacuumStmt *b)
return false;
if (a->verbose != b->verbose)
return false;
if (!equalstr(a->vacrel, b->vacrel))
if (!equal(a->relation, b->relation))
return false;
if (!equal(a->va_cols, b->va_cols))
return false;
@@ -1184,7 +1172,7 @@ _equalExplainStmt(ExplainStmt *a, ExplainStmt *b)
static bool
_equalCreateSeqStmt(CreateSeqStmt *a, CreateSeqStmt *b)
{
if (!equalstr(a->seqname, b->seqname))
if (!equal(a->sequence, b->sequence))
return false;
if (!equal(a->options, b->options))
return false;
@@ -1226,7 +1214,7 @@ _equalCreateTrigStmt(CreateTrigStmt *a, CreateTrigStmt *b)
{
if (!equalstr(a->trigname, b->trigname))
return false;
if (!equalstr(a->relname, b->relname))
if (!equal(a->relation, b->relation))
return false;
if (!equalstr(a->funcname, b->funcname))
return false;
@@ -1252,7 +1240,7 @@ _equalCreateTrigStmt(CreateTrigStmt *a, CreateTrigStmt *b)
return false;
if (a->initdeferred != b->initdeferred)
return false;
if (!equalstr(a->constrrelname, b->constrrelname))
if (!equal(a->constrrel, b->constrrel))
return false;
return true;
@@ -1263,7 +1251,7 @@ _equalDropTrigStmt(DropTrigStmt *a, DropTrigStmt *b)
{
if (!equalstr(a->trigname, b->trigname))
return false;
if (!equalstr(a->relname, b->relname))
if (!equal(a->relation, b->relation))
return false;
return true;
@@ -1340,7 +1328,7 @@ _equalDropUserStmt(DropUserStmt *a, DropUserStmt *b)
static bool
_equalLockStmt(LockStmt *a, LockStmt *b)
{
if (!equal(a->rellist, b->rellist))
if (!equal(a->relations, b->relations))
return false;
if (a->mode != b->mode)
return false;
@@ -1397,6 +1385,8 @@ _equalReindexStmt(ReindexStmt *a, ReindexStmt *b)
{
if (a->reindexType != b->reindexType)
return false;
if (!equal(a->relation, b->relation))
return false;
if (!equalstr(a->name, b->name))
return false;
if (a->force != b->force)
@@ -1407,6 +1397,19 @@ _equalReindexStmt(ReindexStmt *a, ReindexStmt *b)
return true;
}
static bool
_equalCreateSchemaStmt(CreateSchemaStmt *a, CreateSchemaStmt *b)
{
if (!equalstr(a->schemaname, b->schemaname))
return false;
if (!equalstr(a->authid, b->authid))
return false;
if (!equal(a->schemaElts, b->schemaElts))
return false;
return true;
}
static bool
_equalAExpr(A_Expr *a, A_Expr *b)
{
@@ -1423,13 +1426,22 @@ _equalAExpr(A_Expr *a, A_Expr *b)
}
static bool
_equalAttr(Attr *a, Attr *b)
_equalColumnRef(ColumnRef *a, ColumnRef *b)
{
if (strcmp(a->relname, b->relname) != 0)
if (!equal(a->fields, b->fields))
return false;
if (!equal(a->paramNo, b->paramNo))
if (!equal(a->indirection, b->indirection))
return false;
if (!equal(a->attrs, b->attrs))
return true;
}
static bool
_equalParamRef(ParamRef *a, ParamRef *b)
{
if (a->number != b->number)
return false;
if (!equal(a->fields, b->fields))
return false;
if (!equal(a->indirection, b->indirection))
return false;
@@ -1448,28 +1460,11 @@ _equalAConst(A_Const *a, A_Const *b)
return true;
}
static bool
_equalParamNo(ParamNo *a, ParamNo *b)
{
if (a->number != b->number)
return false;
if (!equal(a->typename, b->typename))
return false;
if (!equal(a->indirection, b->indirection))
return false;
return true;
}
static bool
_equalIdent(Ident *a, Ident *b)
{
if (!equalstr(a->name, b->name))
return false;
if (!equal(a->indirection, b->indirection))
return false;
if (a->isRel != b->isRel)
return false;
return true;
}
@@ -1500,6 +1495,19 @@ _equalAIndices(A_Indices *a, A_Indices *b)
return true;
}
static bool
_equalExprFieldSelect(ExprFieldSelect *a, ExprFieldSelect *b)
{
if (!equal(a->arg, b->arg))
return false;
if (!equal(a->fields, b->fields))
return false;
if (!equal(a->indirection, b->indirection))
return false;
return true;
}
static bool
_equalResTarget(ResTarget *a, ResTarget *b)
{
@@ -1535,14 +1543,31 @@ _equalSortGroupBy(SortGroupBy *a, SortGroupBy *b)
return true;
}
static bool
_equalAlias(Alias *a, Alias *b)
{
if (!equalstr(a->aliasname, b->aliasname))
return false;
if (!equal(a->colnames, b->colnames))
return false;
return true;
}
static bool
_equalRangeVar(RangeVar *a, RangeVar *b)
{
if (!equalstr(a->catalogname, b->catalogname))
return false;
if (!equalstr(a->schemaname, b->schemaname))
return false;
if (!equalstr(a->relname, b->relname))
return false;
if (a->inhOpt != b->inhOpt)
return false;
if (!equal(a->name, b->name))
if (a->istemp != b->istemp)
return false;
if (!equal(a->alias, b->alias))
return false;
return true;
@@ -1553,7 +1578,7 @@ _equalRangeSubselect(RangeSubselect *a, RangeSubselect *b)
{
if (!equal(a->subquery, b->subquery))
return false;
if (!equal(a->name, b->name))
if (!equal(a->alias, b->alias))
return false;
return true;
@@ -1704,7 +1729,7 @@ _equalFkConstraint(FkConstraint *a, FkConstraint *b)
{
if (!equalstr(a->constr_name, b->constr_name))
return false;
if (!equalstr(a->pktable_name, b->pktable_name))
if (!equal(a->pktable, b->pktable))
return false;
if (!equal(a->fk_attrs, b->fk_attrs))
return false;
@@ -2111,19 +2136,22 @@ equal(void *a, void *b)
case T_CheckPointStmt:
retval = true;
break;
case T_CreateSchemaStmt:
retval = _equalCreateSchemaStmt(a, b);
break;
case T_A_Expr:
retval = _equalAExpr(a, b);
break;
case T_Attr:
retval = _equalAttr(a, b);
case T_ColumnRef:
retval = _equalColumnRef(a, b);
break;
case T_ParamRef:
retval = _equalParamRef(a, b);
break;
case T_A_Const:
retval = _equalAConst(a, b);
break;
case T_ParamNo:
retval = _equalParamNo(a, b);
break;
case T_Ident:
retval = _equalIdent(a, b);
break;
@@ -2133,6 +2161,9 @@ equal(void *a, void *b)
case T_A_Indices:
retval = _equalAIndices(a, b);
break;
case T_ExprFieldSelect:
retval = _equalExprFieldSelect(a, b);
break;
case T_ResTarget:
retval = _equalResTarget(a, b);
break;
@@ -2142,6 +2173,9 @@ equal(void *a, void *b)
case T_SortGroupBy:
retval = _equalSortGroupBy(a, b);
break;
case T_Alias:
retval = _equalAlias(a, b);
break;
case T_RangeVar:
retval = _equalRangeVar(a, b);
break;

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.27 2002/03/20 19:44:04 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.28 2002/03/21 16:00:40 tgl Exp $
*/
#include "postgres.h"
@@ -159,19 +159,18 @@ makeNullConst(Oid consttype)
}
/*
* makeAttr -
* creates an Attr node
* makeAlias -
* creates an Alias node
*
* NOTE: the given name is copied, but the colnames list (if any) isn't.
*/
Attr *
makeAttr(char *relname, char *attname)
Alias *
makeAlias(const char *aliasname, List *colnames)
{
Attr *a = makeNode(Attr);
Alias *a = makeNode(Alias);
a->relname = pstrdup(relname);
a->paramNo = NULL;
if (attname != NULL)
a->attrs = makeList1(makeString(pstrdup(attname)));
a->indirection = NULL;
a->aliasname = pstrdup(aliasname);
a->colnames = colnames;
return a;
}

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/nodeFuncs.c,v 1.16 2001/10/28 06:25:44 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/nodeFuncs.c,v 1.17 2002/03/21 16:00:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,7 +29,9 @@ static bool var_is_inner(Var *var);
bool
single_node(Node *node)
{
if (IsA(node, Ident) ||IsA(node, Const) ||IsA(node, Var) ||IsA(node, Param))
if (IsA(node, Const) ||
IsA(node, Var) ||
IsA(node, Param))
return true;
else
return false;
@@ -103,13 +105,13 @@ replace_opid(Oper *oper)
* non_null -
* Returns t if the node is a non-null constant, e.g., if the node has a
* valid `constvalue' field.
*
*/
bool
non_null(Expr *c)
{
if (IsA(c, Const) &&!((Const *) c)->constisnull)
if (IsA(c, Const) &&
!((Const *) c)->constisnull)
return true;
else
return false;

View File

@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.149 2002/03/12 00:51:39 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.150 2002/03/21 16:00:40 tgl Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -105,20 +105,19 @@ _outOidList(StringInfo str, List *list)
static void
_outCreateStmt(StringInfo str, CreateStmt *node)
{
appendStringInfo(str, " CREATE :relname ");
_outToken(str, node->relname);
appendStringInfo(str, " CREATE :relation ");
_outNode(str, node->relation);
appendStringInfo(str, " :columns ");
appendStringInfo(str, " :tableElts ");
_outNode(str, node->tableElts);
appendStringInfo(str, " :inhRelnames ");
_outNode(str, node->inhRelnames);
appendStringInfo(str, " :inhRelations ");
_outNode(str, node->inhRelations);
appendStringInfo(str, " :constraints ");
_outNode(str, node->constraints);
appendStringInfo(str, " :istemp %s :hasoids %s ",
booltostr(node->istemp),
appendStringInfo(str, " :hasoids %s ",
booltostr(node->hasoids));
}
@@ -127,8 +126,8 @@ _outIndexStmt(StringInfo str, IndexStmt *node)
{
appendStringInfo(str, " INDEX :idxname ");
_outToken(str, node->idxname);
appendStringInfo(str, " :relname ");
_outToken(str, node->relname);
appendStringInfo(str, " :relation ");
_outNode(str, node->relation);
appendStringInfo(str, " :accessMethod ");
_outToken(str, node->accessMethod);
appendStringInfo(str, " :indexParams ");
@@ -142,6 +141,13 @@ _outIndexStmt(StringInfo str, IndexStmt *node)
booltostr(node->primary));
}
static void
_outNotifyStmt(StringInfo str, NotifyStmt *node)
{
appendStringInfo(str, "NOTIFY :relation ");
_outNode(str, node->relation);
}
static void
_outSelectStmt(StringInfo str, SelectStmt *node)
{
@@ -213,53 +219,40 @@ _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 ", node->commandType);
/*
* Hack to work around missing outfuncs routines for a lot of the
* utility-statement node types. (The only one we actually *need*
* for rules support is NotifyStmt.) Someday we ought to support
* 'em all, but for the meantime do this to avoid getting lots of
* warnings when running with debug_print_parse on.
*/
if (node->utilityStmt)
{
/*
* Hack to make up for lack of outfuncs for utility-stmt nodes
*/
switch (nodeTag(node->utilityStmt))
{
case T_CreateStmt:
appendStringInfo(str, " :create ");
_outToken(str, ((CreateStmt *) (node->utilityStmt))->relname);
appendStringInfo(str, " ");
_outNode(str, node->utilityStmt);
break;
case T_IndexStmt:
appendStringInfo(str, " :index ");
_outToken(str, ((IndexStmt *) (node->utilityStmt))->idxname);
appendStringInfo(str, " on ");
_outToken(str, ((IndexStmt *) (node->utilityStmt))->relname);
appendStringInfo(str, " ");
case T_NotifyStmt:
_outNode(str, node->utilityStmt);
break;
case T_NotifyStmt:
appendStringInfo(str, " :notify ");
_outToken(str, ((NotifyStmt *) (node->utilityStmt))->relname);
break;
default:
appendStringInfo(str, " :utility ? ");
appendStringInfo(str, "?");
break;
}
}
else
appendStringInfo(str, " :utility <>");
appendStringInfo(str, "<>");
appendStringInfo(str, " :resultRelation %d :into ",
node->resultRelation);
_outToken(str, node->into);
_outNode(str, node->into);
appendStringInfo(str, " :isPortal %s :isBinary %s :isTemp %s"
appendStringInfo(str, " :isPortal %s :isBinary %s"
" :hasAggs %s :hasSubLinks %s :rtable ",
booltostr(node->isPortal),
booltostr(node->isBinary),
booltostr(node->isTemp),
booltostr(node->hasAggs),
booltostr(node->hasSubLinks));
_outNode(str, node->rtable);
@@ -963,6 +956,15 @@ _outTargetEntry(StringInfo str, TargetEntry *node)
_outNode(str, node->expr);
}
static void
_outAlias(StringInfo str, Alias *node)
{
appendStringInfo(str, " ALIAS :aliasname ");
_outToken(str, node->aliasname);
appendStringInfo(str, " :colnames ");
_outNode(str, node->colnames);
}
static void
_outRangeTblEntry(StringInfo str, RangeTblEntry *node)
{
@@ -1311,6 +1313,42 @@ _outValue(StringInfo str, Value *value)
}
}
static void
_outRangeVar(StringInfo str, RangeVar *node)
{
appendStringInfo(str, " RANGEVAR :relation ");
/*
* we deliberately ignore catalogname here, since it is presently not
* semantically meaningful
*/
_outToken(str, node->schemaname);
appendStringInfo(str, " . ");
_outToken(str, node->relname);
appendStringInfo(str, " :inhopt %d :istemp %s",
(int) node->inhOpt,
booltostr(node->istemp));
appendStringInfo(str, " :alias ");
_outNode(str, node->alias);
}
static void
_outColumnRef(StringInfo str, ColumnRef *node)
{
appendStringInfo(str, " COLUMNREF :fields ");
_outNode(str, node->fields);
appendStringInfo(str, " :indirection ");
_outNode(str, node->indirection);
}
static void
_outParamRef(StringInfo str, ParamRef *node)
{
appendStringInfo(str, " PARAMREF :number %d :fields ", node->number);
_outNode(str, node->fields);
appendStringInfo(str, " :indirection ");
_outNode(str, node->indirection);
}
static void
_outIdent(StringInfo str, Ident *node)
{
@@ -1318,15 +1356,6 @@ _outIdent(StringInfo str, Ident *node)
_outToken(str, node->name);
}
static void
_outAttr(StringInfo str, Attr *node)
{
appendStringInfo(str, " ATTR :relname ");
_outToken(str, node->relname);
appendStringInfo(str, " :attrs ");
_outNode(str, node->attrs);
}
static void
_outAConst(StringInfo str, A_Const *node)
{
@@ -1336,6 +1365,17 @@ _outAConst(StringInfo str, A_Const *node)
_outNode(str, node->typename);
}
static void
_outExprFieldSelect(StringInfo str, ExprFieldSelect *node)
{
appendStringInfo(str, " EXPRFIELDSELECT :arg ");
_outNode(str, node->arg);
appendStringInfo(str, " :fields ");
_outNode(str, node->fields);
appendStringInfo(str, " :indirection ");
_outNode(str, node->indirection);
}
static void
_outConstraint(StringInfo str, Constraint *node)
{
@@ -1384,8 +1424,8 @@ _outFkConstraint(StringInfo str, FkConstraint *node)
{
appendStringInfo(str, " FKCONSTRAINT :constr_name ");
_outToken(str, node->constr_name);
appendStringInfo(str, " :pktable_name ");
_outToken(str, node->pktable_name);
appendStringInfo(str, " :pktable ");
_outNode(str, node->pktable);
appendStringInfo(str, " :fk_attrs ");
_outNode(str, node->fk_attrs);
appendStringInfo(str, " :pk_attrs ");
@@ -1490,6 +1530,12 @@ _outNode(StringInfo str, void *obj)
case T_IndexStmt:
_outIndexStmt(str, obj);
break;
case T_NotifyStmt:
_outNotifyStmt(str, obj);
break;
case T_SelectStmt:
_outSelectStmt(str, obj);
break;
case T_ColumnDef:
_outColumnDef(str, obj);
break;
@@ -1628,6 +1674,9 @@ _outNode(StringInfo str, void *obj)
case T_TargetEntry:
_outTargetEntry(str, obj);
break;
case T_Alias:
_outAlias(str, obj);
break;
case T_RangeTblEntry:
_outRangeTblEntry(str, obj);
break;
@@ -1670,12 +1719,24 @@ _outNode(StringInfo str, void *obj)
case T_A_Expr:
_outAExpr(str, obj);
break;
case T_RangeVar:
_outRangeVar(str, obj);
break;
case T_ColumnRef:
_outColumnRef(str, obj);
break;
case T_ParamRef:
_outParamRef(str, obj);
break;
case T_Ident:
_outIdent(str, obj);
break;
case T_A_Const:
_outAConst(str, obj);
break;
case T_ExprFieldSelect:
_outExprFieldSelect(str, obj);
break;
case T_Constraint:
_outConstraint(str, obj);
break;
@@ -1694,17 +1755,9 @@ _outNode(StringInfo str, void *obj)
case T_BooleanTest:
_outBooleanTest(str, obj);
break;
case T_VariableSetStmt:
break;
case T_SelectStmt:
_outSelectStmt(str, obj);
break;
case T_FuncCall:
_outFuncCall(str, obj);
break;
case T_Attr:
_outAttr(str, obj);
break;
default:
elog(WARNING, "_outNode: don't know how to print type %d ",

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.51 2001/12/20 02:39:26 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.52 2002/03/21 16:00:41 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -154,10 +154,10 @@ print_rt(List *rtable)
if (rte->relname)
printf("%d\t%s (%s)\t%u",
i, rte->relname, rte->eref->relname, rte->relid);
i, rte->relname, rte->eref->aliasname, rte->relid);
else
printf("%d\t[subquery] (%s)\t",
i, rte->eref->relname);
i, rte->eref->aliasname);
printf("\t%s\t%s\n",
(rte->inh ? "inh" : ""),
(rte->inFromCl ? "inFromCl" : ""));
@@ -202,7 +202,7 @@ print_expr(Node *expr, List *rtable)
Assert(var->varno > 0 &&
(int) var->varno <= length(rtable));
rte = rt_fetch(var->varno, rtable);
relname = rte->eref->relname;
relname = rte->eref->aliasname;
attname = get_rte_attribute_name(rte, var->varattno);
}
break;

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.116 2002/03/12 00:51:39 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.117 2002/03/21 16:00:42 tgl Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
@@ -119,34 +119,19 @@ _readQuery(void)
local_node = makeNode(Query);
token = pg_strtok(&length); /* skip the :command */
token = pg_strtok(&length); /* get the commandType */
token = pg_strtok(&length); /* skip :command */
token = pg_strtok(&length); /* get commandType */
local_node->commandType = atoi(token);
token = pg_strtok(&length); /* skip :utility */
token = pg_strtok(&length);
if (length == 0)
local_node->utilityStmt = NULL;
else
{
/*
* Hack to make up for lack of readfuncs for utility-stmt nodes
*
* we can't get create or index here, can we?
*/
NotifyStmt *n = makeNode(NotifyStmt);
local_node->utilityStmt = nodeRead(true);
n->relname = debackslash(token, length);
local_node->utilityStmt = (Node *) n;
}
token = pg_strtok(&length); /* skip the :resultRelation */
token = pg_strtok(&length); /* skip :resultRelation */
token = pg_strtok(&length); /* get the resultRelation */
local_node->resultRelation = atoi(token);
token = pg_strtok(&length); /* skip :into */
token = pg_strtok(&length); /* get into */
local_node->into = nullable_string(token, length);
local_node->into = nodeRead(true);
token = pg_strtok(&length); /* skip :isPortal */
token = pg_strtok(&length); /* get isPortal */
@@ -156,10 +141,6 @@ _readQuery(void)
token = pg_strtok(&length); /* get isBinary */
local_node->isBinary = strtobool(token);
token = pg_strtok(&length); /* skip :isTemp */
token = pg_strtok(&length); /* get isTemp */
local_node->isTemp = strtobool(token);
token = pg_strtok(&length); /* skip the :hasAggs */
token = pg_strtok(&length); /* get hasAggs */
local_node->hasAggs = strtobool(token);
@@ -210,6 +191,25 @@ _readQuery(void)
return local_node;
}
/* ----------------
* _readNotifyStmt
* ----------------
*/
static NotifyStmt *
_readNotifyStmt(void)
{
NotifyStmt *local_node;
char *token;
int length;
local_node = makeNode(NotifyStmt);
token = pg_strtok(&length); /* skip :relation */
local_node->relation = nodeRead(true);
return local_node;
}
/* ----------------
* _readSortClause
* ----------------
@@ -1394,21 +1394,93 @@ _readTargetEntry(void)
return local_node;
}
static Attr *
_readAttr(void)
static RangeVar *
_readRangeVar(void)
{
Attr *local_node;
RangeVar *local_node;
char *token;
int length;
local_node = makeNode(Attr);
local_node = makeNode(RangeVar);
token = pg_strtok(&length); /* eat :relname */
local_node->catalogname = NULL; /* not currently saved in output format */
token = pg_strtok(&length); /* eat :relation */
token = pg_strtok(&length); /* get schemaname */
local_node->schemaname = nullable_string(token, length);
token = pg_strtok(&length); /* eat "." */
token = pg_strtok(&length); /* get relname */
local_node->relname = debackslash(token, length);
local_node->relname = nullable_string(token, length);
token = pg_strtok(&length); /* eat :inhopt */
token = pg_strtok(&length); /* get inhopt */
local_node->inhOpt = (InhOption) atoi(token);
token = pg_strtok(&length); /* eat :istemp */
token = pg_strtok(&length); /* get istemp */
local_node->istemp = strtobool(token);
token = pg_strtok(&length); /* eat :attrs */
local_node->attrs = nodeRead(true); /* now read it */
token = pg_strtok(&length); /* eat :alias */
local_node->alias = nodeRead(true); /* now read it */
return local_node;
}
static ColumnRef *
_readColumnRef(void)
{
ColumnRef *local_node;
char *token;
int length;
local_node = makeNode(ColumnRef);
token = pg_strtok(&length); /* eat :fields */
local_node->fields = nodeRead(true); /* now read it */
token = pg_strtok(&length); /* eat :indirection */
local_node->indirection = nodeRead(true); /* now read it */
return local_node;
}
static ExprFieldSelect *
_readExprFieldSelect(void)
{
ExprFieldSelect *local_node;
char *token;
int length;
local_node = makeNode(ExprFieldSelect);
token = pg_strtok(&length); /* eat :arg */
local_node->arg = nodeRead(true); /* now read it */
token = pg_strtok(&length); /* eat :fields */
local_node->fields = nodeRead(true); /* now read it */
token = pg_strtok(&length); /* eat :indirection */
local_node->indirection = nodeRead(true); /* now read it */
return local_node;
}
static Alias *
_readAlias(void)
{
Alias *local_node;
char *token;
int length;
local_node = makeNode(Alias);
token = pg_strtok(&length); /* eat :aliasname */
token = pg_strtok(&length); /* get aliasname */
local_node->aliasname = debackslash(token, length);
token = pg_strtok(&length); /* eat :colnames */
local_node->colnames = nodeRead(true); /* now read it */
return local_node;
}
@@ -1994,8 +2066,6 @@ parsePlanString(void)
return_value = _readArrayRef();
else if (length == 3 && strncmp(token, "VAR", length) == 0)
return_value = _readVar();
else if (length == 4 && strncmp(token, "ATTR", length) == 0)
return_value = _readAttr();
else if (length == 5 && strncmp(token, "CONST", length) == 0)
return_value = _readConst();
else if (length == 4 && strncmp(token, "FUNC", length) == 0)
@@ -2006,6 +2076,14 @@ parsePlanString(void)
return_value = _readParam();
else if (length == 11 && strncmp(token, "TARGETENTRY", length) == 0)
return_value = _readTargetEntry();
else if (length == 8 && strncmp(token, "RANGEVAR", length) == 0)
return_value = _readRangeVar();
else if (length == 9 && strncmp(token, "COLUMNREF", length) == 0)
return_value = _readColumnRef();
else if (length == 15 && strncmp(token, "EXPRFIELDSELECT", length) == 0)
return_value = _readExprFieldSelect();
else if (length == 5 && strncmp(token, "ALIAS", length) == 0)
return_value = _readAlias();
else if (length == 3 && strncmp(token, "RTE", length) == 0)
return_value = _readRangeTblEntry();
else if (length == 4 && strncmp(token, "PATH", length) == 0)
@@ -2032,6 +2110,8 @@ parsePlanString(void)
return_value = _readIter();
else if (length == 5 && strncmp(token, "QUERY", length) == 0)
return_value = _readQuery();
else if (length == 6 && strncmp(token, "NOTIFY", length) == 0)
return_value = _readNotifyStmt();
else if (length == 10 && strncmp(token, "SORTCLAUSE", length) == 0)
return_value = _readSortClause();
else if (length == 11 && strncmp(token, "GROUPCLAUSE", length) == 0)