提交 a0bf885f 编写于 作者: T Tom Lane

Phase 2 of read-only-plans project: restructure expression-tree nodes

so that all executable expression nodes inherit from a common supertype
Expr.  This is somewhat of an exercise in code purity rather than any
real functional advance, but getting rid of the extra Oper or Func node
formerly used in each operator or function call should provide at least
a little space and speed improvement.
initdb forced by changes in stored-rules representation.
上级 debb0728
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/dependency.c,v 1.17 2002/12/06 05:00:10 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/dependency.c,v 1.18 2002/12/12 15:49:21 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -806,25 +806,28 @@ find_expr_references_walker(Node *node, ...@@ -806,25 +806,28 @@ find_expr_references_walker(Node *node,
} }
return false; return false;
} }
if (IsA(node, Expr)) if (IsA(node, FuncExpr))
{ {
Expr *expr = (Expr *) node; FuncExpr *funcexpr = (FuncExpr *) node;
if (expr->opType == OP_EXPR || add_object_address(OCLASS_PROC, funcexpr->funcid, 0,
expr->opType == DISTINCT_EXPR) &context->addrs);
/* fall through to examine arguments */
}
if (IsA(node, OpExpr))
{ {
Oper *oper = (Oper *) expr->oper; OpExpr *opexpr = (OpExpr *) node;
add_object_address(OCLASS_OPERATOR, oper->opno, 0, add_object_address(OCLASS_OPERATOR, opexpr->opno, 0,
&context->addrs); &context->addrs);
/* fall through to examine arguments */
} }
else if (expr->opType == FUNC_EXPR) if (IsA(node, DistinctExpr))
{ {
Func *func = (Func *) expr->oper; DistinctExpr *distinctexpr = (DistinctExpr *) node;
add_object_address(OCLASS_PROC, func->funcid, 0, add_object_address(OCLASS_OPERATOR, distinctexpr->opno, 0,
&context->addrs); &context->addrs);
}
/* fall through to examine arguments */ /* fall through to examine arguments */
} }
if (IsA(node, Aggref)) if (IsA(node, Aggref))
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.235 2002/11/15 02:50:05 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.236 2002/12/12 15:49:23 tgl Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -1602,11 +1602,6 @@ AddRelationRawConstraints(Relation rel, ...@@ -1602,11 +1602,6 @@ AddRelationRawConstraints(Relation rel,
*/ */
expr = (Node *) make_ands_implicit((Expr *) expr); expr = (Node *) make_ands_implicit((Expr *) expr);
/*
* Must fix opids in operator clauses.
*/
fix_opids(expr);
/* /*
* OK, store it. * OK, store it.
*/ */
...@@ -1750,11 +1745,6 @@ cookDefault(ParseState *pstate, ...@@ -1750,11 +1745,6 @@ cookDefault(ParseState *pstate,
*/ */
expr = eval_const_expressions(expr); expr = eval_const_expressions(expr);
/*
* Must fix opids, in case any operators remain...
*/
fix_opids(expr);
return (expr); return (expr);
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.205 2002/11/13 00:39:46 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.206 2002/12/12 15:49:24 tgl Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "executor/executor.h" #include "executor/executor.h"
#include "miscadmin.h" #include "miscadmin.h"
#include "optimizer/clauses.h" #include "optimizer/clauses.h"
#include "optimizer/planmain.h"
#include "optimizer/prep.h" #include "optimizer/prep.h"
#include "parser/parse_func.h" #include "parser/parse_func.h"
#include "storage/sinval.h" #include "storage/sinval.h"
...@@ -919,6 +920,7 @@ BuildIndexInfo(Form_pg_index indexStruct) ...@@ -919,6 +920,7 @@ BuildIndexInfo(Form_pg_index indexStruct)
predString = DatumGetCString(DirectFunctionCall1(textout, predString = DatumGetCString(DirectFunctionCall1(textout,
PointerGetDatum(&indexStruct->indpred))); PointerGetDatum(&indexStruct->indpred)));
ii->ii_Predicate = stringToNode(predString); ii->ii_Predicate = stringToNode(predString);
fix_opfuncids((Node *) ii->ii_Predicate);
pfree(predString); pfree(predString);
} }
else else
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.94 2002/09/18 21:35:20 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.95 2002/12/12 15:49:24 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -424,7 +424,7 @@ checkretval(Oid rettype, char fn_typtype, List *queryTreeList) ...@@ -424,7 +424,7 @@ checkretval(Oid rettype, char fn_typtype, List *queryTreeList)
} while (attr->attisdropped); } while (attr->attisdropped);
rellogcols++; rellogcols++;
tletype = exprType(tle->expr); tletype = exprType((Node *) tle->expr);
atttype = attr->atttypid; atttype = attr->atttypid;
if (!IsBinaryCoercible(tletype, atttype)) if (!IsBinaryCoercible(tletype, atttype))
elog(ERROR, "function declared to return %s returns %s instead of %s at column %d", elog(ERROR, "function declared to return %s returns %s instead of %s at column %d",
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.184 2002/12/01 18:14:22 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.185 2002/12/12 15:49:24 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "mb/pg_wchar.h" #include "mb/pg_wchar.h"
#include "miscadmin.h" #include "miscadmin.h"
#include "nodes/makefuncs.h" #include "nodes/makefuncs.h"
#include "optimizer/planmain.h"
#include "parser/parse_coerce.h" #include "parser/parse_coerce.h"
#include "parser/parse_relation.h" #include "parser/parse_relation.h"
#include "rewrite/rewriteHandler.h" #include "rewrite/rewriteHandler.h"
...@@ -839,6 +840,7 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids, ...@@ -839,6 +840,7 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
defexprs[num_defaults] = build_column_default(rel, i + 1); defexprs[num_defaults] = build_column_default(rel, i + 1);
if (defexprs[num_defaults] != NULL) if (defexprs[num_defaults] != NULL)
{ {
fix_opfuncids(defexprs[num_defaults]);
defmap[num_defaults] = i; defmap[num_defaults] = i;
num_defaults++; num_defaults++;
} }
...@@ -869,6 +871,7 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids, ...@@ -869,6 +871,7 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
/* check whether any constraints actually found */ /* check whether any constraints actually found */
if (node != (Node *) prm) if (node != (Node *) prm)
{ {
fix_opfuncids(node);
constraintexprs[i] = node; constraintexprs[i] = node;
hasConstraints = true; hasConstraints = true;
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California * Portions Copyright (c) 1994-5, Regents of the University of California
* *
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.95 2002/12/06 19:28:03 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.96 2002/12/12 15:49:24 tgl Exp $
* *
*/ */
...@@ -417,20 +417,27 @@ explain_outNode(StringInfo str, ...@@ -417,20 +417,27 @@ explain_outNode(StringInfo str,
{ {
RangeTblEntry *rte = rt_fetch(((Scan *) plan)->scanrelid, RangeTblEntry *rte = rt_fetch(((Scan *) plan)->scanrelid,
es->rtable); es->rtable);
Expr *expr;
Func *funcnode;
Oid funcid;
char *proname; char *proname;
/* Assert it's on a RangeFunction */ /* Assert it's on a RangeFunction */
Assert(rte->rtekind == RTE_FUNCTION); Assert(rte->rtekind == RTE_FUNCTION);
expr = (Expr *) rte->funcexpr; /*
funcnode = (Func *) expr->oper; * If the expression is still a function call, we can get
funcid = funcnode->funcid; * the real name of the function. Otherwise, punt (this
* can happen if the optimizer simplified away the function
* call, for example).
*/
if (rte->funcexpr && IsA(rte->funcexpr, FuncExpr))
{
FuncExpr *funcexpr = (FuncExpr *) rte->funcexpr;
Oid funcid = funcexpr->funcid;
/* We only show the func name, not schema name */ /* We only show the func name, not schema name */
proname = get_func_name(funcid); proname = get_func_name(funcid);
}
else
proname = rte->eref->aliasname;
appendStringInfo(str, " on %s", appendStringInfo(str, " on %s",
quote_identifier(proname)); quote_identifier(proname));
...@@ -583,7 +590,7 @@ explain_outNode(StringInfo str, ...@@ -583,7 +590,7 @@ explain_outNode(StringInfo str,
appendStringInfo(str, " InitPlan\n"); appendStringInfo(str, " InitPlan\n");
foreach(lst, plan->initPlan) foreach(lst, plan->initPlan)
{ {
SubPlan *subplan = (SubPlan *) lfirst(lst); SubPlanExpr *subplan = (SubPlanExpr *) lfirst(lst);
SubPlanState *subplanstate = (SubPlanState *) lfirst(pslist); SubPlanState *subplanstate = (SubPlanState *) lfirst(pslist);
es->rtable = subplan->rtable; es->rtable = subplan->rtable;
...@@ -683,7 +690,7 @@ explain_outNode(StringInfo str, ...@@ -683,7 +690,7 @@ explain_outNode(StringInfo str,
foreach(lst, planstate->subPlan) foreach(lst, planstate->subPlan)
{ {
SubPlanState *sps = (SubPlanState *) lfirst(lst); SubPlanState *sps = (SubPlanState *) lfirst(lst);
SubPlan *sp = (SubPlan *) sps->ps.plan; SubPlanExpr *sp = (SubPlanExpr *) sps->ps.plan;
es->rtable = sp->rtable; es->rtable = sp->rtable;
for (i = 0; i < indent; i++) for (i = 0; i < indent; i++)
...@@ -870,7 +877,7 @@ show_sort_keys(List *tlist, int nkeys, const char *qlabel, ...@@ -870,7 +877,7 @@ show_sort_keys(List *tlist, int nkeys, const char *qlabel,
if (target->resdom->reskey == keyno) if (target->resdom->reskey == keyno)
{ {
/* Deparse the expression, showing any top-level cast */ /* Deparse the expression, showing any top-level cast */
exprstr = deparse_expression(target->expr, context, exprstr = deparse_expression((Node *) target->expr, context,
useprefix, true); useprefix, true);
/* And add to str */ /* And add to str */
if (keyno > 1) if (keyno > 1)
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.92 2002/10/21 22:06:19 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.93 2002/12/12 15:49:24 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -159,10 +159,10 @@ DefineIndex(RangeVar *heapRelation, ...@@ -159,10 +159,10 @@ DefineIndex(RangeVar *heapRelation,
* While we are at it, we reduce it to a canonical (CNF or DNF) form * While we are at it, we reduce it to a canonical (CNF or DNF) form
* to simplify the task of proving implications. * to simplify the task of proving implications.
*/ */
if (predicate != NULL && rangetable != NIL) if (predicate)
{ {
cnfPred = canonicalize_qual((Expr *) copyObject(predicate), true); cnfPred = canonicalize_qual((Expr *) copyObject(predicate), true);
fix_opids((Node *) cnfPred); fix_opfuncids((Node *) cnfPred);
CheckPredicate(cnfPred, rangetable, relationId); CheckPredicate(cnfPred, rangetable, relationId);
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.57 2002/11/23 18:26:45 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.58 2002/12/12 15:49:24 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -2723,7 +2723,7 @@ AlterTableAddCheckConstraint(Relation rel, Constraint *constr) ...@@ -2723,7 +2723,7 @@ AlterTableAddCheckConstraint(Relation rel, Constraint *constr)
/* /*
* We need to make a parse state and range * We need to make a parse state and range
* table to allow us to transformExpr and * table to allow us to transformExpr and
* fix_opids to get a version of the * fix_opfuncids to get a version of the
* expression we can pass to ExecQual * expression we can pass to ExecQual
*/ */
pstate = make_parsestate(NULL); pstate = make_parsestate(NULL);
...@@ -2764,8 +2764,8 @@ AlterTableAddCheckConstraint(Relation rel, Constraint *constr) ...@@ -2764,8 +2764,8 @@ AlterTableAddCheckConstraint(Relation rel, Constraint *constr)
*/ */
expr = eval_const_expressions(expr); expr = eval_const_expressions(expr);
/* And fix the opids */ /* And fix the opfuncids */
fix_opids(expr); fix_opfuncids(expr);
qual = makeList1(expr); qual = makeList1(expr);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.21 2002/12/09 20:31:05 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.22 2002/12/12 15:49:24 tgl Exp $
* *
* DESCRIPTION * DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the * The "DefineFoo" routines take the parse tree and pick out the
...@@ -1341,7 +1341,9 @@ AlterDomainAddConstraint(List *names, Node *newConstraint) ...@@ -1341,7 +1341,9 @@ AlterDomainAddConstraint(List *names, Node *newConstraint)
* the constraint is being added to. * the constraint is being added to.
*/ */
expr = stringToNode(ccbin); expr = stringToNode(ccbin);
fix_opfuncids(expr);
rels = get_rels_with_domain(domainoid); rels = get_rels_with_domain(domainoid);
foreach (rt, rels) foreach (rt, rels)
{ {
Relation typrel; Relation typrel;
...@@ -1522,7 +1524,7 @@ domainPermissionCheck(HeapTuple tup, TypeName *typename) ...@@ -1522,7 +1524,7 @@ domainPermissionCheck(HeapTuple tup, TypeName *typename)
/* /*
* * domainAddConstraint
*/ */
char * char *
domainAddConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid, domainAddConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid,
...@@ -1601,16 +1603,15 @@ domainAddConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid, ...@@ -1601,16 +1603,15 @@ domainAddConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid,
expr = eval_const_expressions(expr); expr = eval_const_expressions(expr);
/* /*
* Must fix opids in operator clauses. * Convert to string form for storage.
*/ */
fix_opids(expr);
ccbin = nodeToString(expr); ccbin = nodeToString(expr);
/* /*
* Deparse it. Since VARNOs aren't allowed in domain * Deparse it to produce text for consrc.
* constraints, relation context isn't required as anything *
* other than a shell. * Since VARNOs aren't allowed in domain constraints, relation context
* isn't required as anything other than a shell.
*/ */
ccsrc = deparse_expression(expr, ccsrc = deparse_expression(expr,
deparse_context_for(domainName, deparse_context_for(domainName,
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.32 2002/09/04 20:31:17 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.33 2002/12/12 15:49:28 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -77,7 +77,7 @@ ExecInitJunkFilter(List *targetList, TupleDesc tupType, ...@@ -77,7 +77,7 @@ ExecInitJunkFilter(List *targetList, TupleDesc tupType,
bool resjunk; bool resjunk;
AttrNumber cleanResno; AttrNumber cleanResno;
AttrNumber *cleanMap; AttrNumber *cleanMap;
Node *expr; Expr *expr;
/* /*
* Make a memory context that will hold the JunkFilter as well as all * Make a memory context that will hold the JunkFilter as well as all
...@@ -104,8 +104,6 @@ ExecInitJunkFilter(List *targetList, TupleDesc tupType, ...@@ -104,8 +104,6 @@ ExecInitJunkFilter(List *targetList, TupleDesc tupType,
{ {
TargetEntry *rtarget = lfirst(t); TargetEntry *rtarget = lfirst(t);
if (rtarget->resdom != NULL)
{
resdom = rtarget->resdom; resdom = rtarget->resdom;
expr = rtarget->expr; expr = rtarget->expr;
resjunk = resdom->resjunk; resjunk = resdom->resjunk;
...@@ -125,46 +123,6 @@ ExecInitJunkFilter(List *targetList, TupleDesc tupType, ...@@ -125,46 +123,6 @@ ExecInitJunkFilter(List *targetList, TupleDesc tupType,
cleanTargetList = lappend(cleanTargetList, tle); cleanTargetList = lappend(cleanTargetList, tle);
} }
} }
else
{
#ifdef SETS_FIXED
List *fjListP;
Fjoin *cleanFjoin;
List *cleanFjList;
List *fjList = lfirst(t);
Fjoin *fjNode = (Fjoin *) tl_node(fjList);
cleanFjoin = (Fjoin) copyObject((Node) fjNode);
cleanFjList = makeList1(cleanFjoin);
resdom = (Resdom) lfirst(get_fj_innerNode(fjNode));
expr = lsecond(get_fj_innerNode(fjNode));
cleanResdom = (Resdom) copyObject((Node) resdom);
set_resno(cleanResdom, cleanResno);
cleanResno++;
tle = (List) makeTargetEntry(cleanResdom, (Node *) expr);
set_fj_innerNode(cleanFjoin, tle);
foreach(fjListP, lnext(fjList))
{
TargetEntry *tle = lfirst(fjListP);
resdom = tle->resdom;
expr = tle->expr;
cleanResdom = (Resdom *) copyObject((Node) resdom);
cleanResno++;
cleanResdom->Resno = cleanResno;
/*
* create a new target list entry
*/
tle = (List) makeTargetEntry(cleanResdom, (Node *) expr);
cleanFjList = lappend(cleanFjList, tle);
}
lappend(cleanTargetList, cleanFjList);
#endif
}
}
/* /*
* Now calculate the tuple type for the cleaned tuple (we were already * Now calculate the tuple type for the cleaned tuple (we were already
...@@ -192,10 +150,7 @@ ExecInitJunkFilter(List *targetList, TupleDesc tupType, ...@@ -192,10 +150,7 @@ ExecInitJunkFilter(List *targetList, TupleDesc tupType,
{ {
TargetEntry *tle = lfirst(t); TargetEntry *tle = lfirst(t);
if (tle->resdom != NULL)
{
resdom = tle->resdom; resdom = tle->resdom;
expr = tle->expr;
resjunk = resdom->resjunk; resjunk = resdom->resjunk;
if (!resjunk) if (!resjunk)
{ {
...@@ -203,32 +158,6 @@ ExecInitJunkFilter(List *targetList, TupleDesc tupType, ...@@ -203,32 +158,6 @@ ExecInitJunkFilter(List *targetList, TupleDesc tupType,
cleanResno++; cleanResno++;
} }
} }
else
{
#ifdef SETS_FIXED
List fjListP;
List fjList = lfirst(t);
Fjoin fjNode = (Fjoin) lfirst(fjList);
/* what the hell is this????? */
resdom = (Resdom) lfirst(get_fj_innerNode(fjNode));
#endif
cleanMap[cleanResno - 1] = tle->resdom->resno;
cleanResno++;
#ifdef SETS_FIXED
foreach(fjListP, lnext(fjList))
{
TargetEntry *tle = lfirst(fjListP);
resdom = tle->resdom;
cleanMap[cleanResno - 1] = resdom->resno;
cleanResno++;
}
#endif
}
}
} }
else else
cleanMap = NULL; cleanMap = NULL;
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.190 2002/12/05 15:50:30 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.191 2002/12/12 15:49:24 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "executor/execdebug.h" #include "executor/execdebug.h"
#include "executor/execdefs.h" #include "executor/execdefs.h"
#include "miscadmin.h" #include "miscadmin.h"
#include "optimizer/planmain.h"
#include "optimizer/var.h" #include "optimizer/var.h"
#include "parser/parsetree.h" #include "parser/parsetree.h"
#include "utils/acl.h" #include "utils/acl.h"
...@@ -1541,6 +1542,7 @@ ExecRelCheck(ResultRelInfo *resultRelInfo, ...@@ -1541,6 +1542,7 @@ ExecRelCheck(ResultRelInfo *resultRelInfo,
for (i = 0; i < ncheck; i++) for (i = 0; i < ncheck; i++)
{ {
qual = (List *) stringToNode(check[i].ccbin); qual = (List *) stringToNode(check[i].ccbin);
fix_opfuncids((Node *) qual);
resultRelInfo->ri_ConstraintExprs[i] = qual; resultRelInfo->ri_ConstraintExprs[i] = qual;
} }
MemoryContextSwitchTo(oldContext); MemoryContextSwitchTo(oldContext);
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.31 2002/12/05 15:50:31 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.32 2002/12/12 15:49:24 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -228,9 +228,9 @@ ExecInitNode(Plan *node, EState *estate) ...@@ -228,9 +228,9 @@ ExecInitNode(Plan *node, EState *estate)
subps = NIL; subps = NIL;
foreach(subp, node->initPlan) foreach(subp, node->initPlan)
{ {
SubPlan *subplan = (SubPlan *) lfirst(subp); SubPlanExpr *subplan = (SubPlanExpr *) lfirst(subp);
Assert(IsA(subplan, SubPlan)); Assert(IsA(subplan, SubPlanExpr));
subps = lappend(subps, ExecInitSubPlan(subplan, estate)); subps = lappend(subps, ExecInitSubPlan(subplan, estate));
} }
result->initPlan = subps; result->initPlan = subps;
...@@ -242,9 +242,9 @@ ExecInitNode(Plan *node, EState *estate) ...@@ -242,9 +242,9 @@ ExecInitNode(Plan *node, EState *estate)
subps = NIL; subps = NIL;
foreach(subp, result->subPlan) foreach(subp, result->subPlan)
{ {
SubPlan *subplan = (SubPlan *) lfirst(subp); SubPlanExpr *subplan = (SubPlanExpr *) lfirst(subp);
Assert(IsA(subplan, SubPlan)); Assert(IsA(subplan, SubPlanExpr));
subps = lappend(subps, ExecInitSubPlan(subplan, estate)); subps = lappend(subps, ExecInitSubPlan(subplan, estate));
} }
result->subPlan = subps; result->subPlan = subps;
......
此差异已折叠。
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.61 2002/12/05 15:50:32 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.62 2002/12/12 15:49:28 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -576,93 +576,15 @@ ExecTypeFromTL(List *targetList, bool hasoid) ...@@ -576,93 +576,15 @@ ExecTypeFromTL(List *targetList, bool hasoid)
foreach(tlitem, targetList) foreach(tlitem, targetList)
{ {
TargetEntry *tle = lfirst(tlitem); TargetEntry *tle = lfirst(tlitem);
Resdom *resdom; Resdom *resdom = tle->resdom;
Oid restype;
if (tle->resdom != NULL)
{
resdom = tle->resdom;
restype = resdom->restype;
TupleDescInitEntry(typeInfo, TupleDescInitEntry(typeInfo,
resdom->resno, resdom->resno,
resdom->resname, resdom->resname,
restype, resdom->restype,
resdom->restypmod, resdom->restypmod,
0, 0,
false); false);
#ifdef NOT_USED
ExecSetTypeInfo(resdom->resno - 1,
typeInfo,
(Oid) restype,
resdom->resno,
resdom->reslen,
NameStr(*resdom->resname),
get_typbyval(restype),
get_typalign(restype));
#endif
}
else
{
/* XXX this branch looks fairly broken ... tgl 12/2000 */
Resdom *fjRes;
List *fjTlistP;
List *fjList = lfirst(tlitem);
#ifdef SETS_FIXED
TargetEntry *tle;
Fjoin *fjNode = ((TargetEntry *) lfirst(fjList))->fjoin;
tle = fjNode->fj_innerNode; /* ??? */
#endif
fjRes = tle->resdom;
restype = fjRes->restype;
TupleDescInitEntry(typeInfo,
fjRes->resno,
fjRes->resname,
restype,
fjRes->restypmod,
0,
false);
#ifdef NOT_USED
ExecSetTypeInfo(fjRes->resno - 1,
typeInfo,
(Oid) restype,
fjRes->resno,
fjRes->reslen,
(char *) fjRes->resname,
get_typbyval(restype),
get_typalign(restype));
#endif
foreach(fjTlistP, lnext(fjList))
{
TargetEntry *fjTle = lfirst(fjTlistP);
fjRes = fjTle->resdom;
TupleDescInitEntry(typeInfo,
fjRes->resno,
fjRes->resname,
restype,
fjRes->restypmod,
0,
false);
#ifdef NOT_USED
ExecSetTypeInfo(fjRes->resno - 1,
typeInfo,
(Oid) fjRes->restype,
fjRes->resno,
fjRes->reslen,
(char *) fjRes->resname,
get_typbyval(fjRes->restype),
get_typalign(fjRes->restype));
#endif
}
}
} }
return typeInfo; return typeInfo;
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.98 2002/12/05 15:50:32 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.99 2002/12/12 15:49:24 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -415,7 +415,7 @@ advance_aggregates(AggState *aggstate, AggStatePerGroup pergroup) ...@@ -415,7 +415,7 @@ advance_aggregates(AggState *aggstate, AggStatePerGroup pergroup)
Datum newVal; Datum newVal;
bool isNull; bool isNull;
newVal = ExecEvalExprSwitchContext(aggref->target, econtext, newVal = ExecEvalExprSwitchContext((Node *) aggref->target, econtext,
&isNull, NULL); &isNull, NULL);
if (aggref->aggdistinct) if (aggref->aggdistinct)
...@@ -1298,7 +1298,7 @@ ExecInitAgg(Agg *node, EState *estate) ...@@ -1298,7 +1298,7 @@ ExecInitAgg(Agg *node, EState *estate)
* pg_proc.proargtypes, because the latter might be 0. * pg_proc.proargtypes, because the latter might be 0.
* (Consider COUNT(*).) * (Consider COUNT(*).)
*/ */
Oid inputType = exprType(aggref->target); Oid inputType = exprType((Node *) aggref->target);
if (!IsBinaryCoercible(inputType, aggform->aggtranstype)) if (!IsBinaryCoercible(inputType, aggform->aggtranstype))
elog(ERROR, "Aggregate %u needs to have compatible input type and transition type", elog(ERROR, "Aggregate %u needs to have compatible input type and transition type",
...@@ -1312,7 +1312,7 @@ ExecInitAgg(Agg *node, EState *estate) ...@@ -1312,7 +1312,7 @@ ExecInitAgg(Agg *node, EState *estate)
* pg_proc.proargtypes, because the latter might be a pseudotype. * pg_proc.proargtypes, because the latter might be a pseudotype.
* (Consider COUNT(*).) * (Consider COUNT(*).)
*/ */
Oid inputType = exprType(aggref->target); Oid inputType = exprType((Node *) aggref->target);
Oid eq_function; Oid eq_function;
/* We don't implement DISTINCT aggs in the HASHED case */ /* We don't implement DISTINCT aggs in the HASHED case */
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.72 2002/12/05 15:50:33 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.73 2002/12/12 15:49:24 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -703,28 +703,26 @@ ExecInitIndexScan(IndexScan *node, EState *estate) ...@@ -703,28 +703,26 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
listscan = qual; listscan = qual;
for (j = 0; j < n_keys; j++) for (j = 0; j < n_keys; j++)
{ {
Expr *clause; /* one clause of index qual */ OpExpr *clause; /* one clause of index qual */
Oper *op; /* operator used in clause */
Node *leftop; /* expr on lhs of operator */ Node *leftop; /* expr on lhs of operator */
Node *rightop; /* expr on rhs ... */ Node *rightop; /* expr on rhs ... */
bits16 flags = 0; bits16 flags = 0;
int scanvar; /* which var identifies varattno */ int scanvar; /* which var identifies varattno */
AttrNumber varattno = 0; /* att number used in scan */ AttrNumber varattno = 0; /* att number used in scan */
Oid opid; /* operator id used in scan */ Oid opfuncid; /* operator id used in scan */
Datum scanvalue = 0; /* value used in scan (if const) */ Datum scanvalue = 0; /* value used in scan (if const) */
/* /*
* extract clause information from the qualification * extract clause information from the qualification
*/ */
clause = lfirst(listscan); clause = (OpExpr *) lfirst(listscan);
listscan = lnext(listscan); listscan = lnext(listscan);
op = (Oper *) clause->oper; if (!IsA(clause, OpExpr))
if (!IsA(clause, Expr) ||!IsA(op, Oper))
elog(ERROR, "ExecInitIndexScan: indxqual not an opclause!"); elog(ERROR, "ExecInitIndexScan: indxqual not an opclause!");
opid = op->opid; opfuncid = clause->opfuncid;
/* /*
* Here we figure out the contents of the index qual. The * Here we figure out the contents of the index qual. The
...@@ -767,10 +765,10 @@ ExecInitIndexScan(IndexScan *node, EState *estate) ...@@ -767,10 +765,10 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
/* /*
* determine information in leftop * determine information in leftop
*/ */
leftop = (Node *) get_leftop(clause); leftop = (Node *) get_leftop((Expr *) clause);
if (leftop && IsA(leftop, RelabelType)) if (leftop && IsA(leftop, RelabelType))
leftop = ((RelabelType *) leftop)->arg; leftop = (Node *) ((RelabelType *) leftop)->arg;
Assert(leftop != NULL); Assert(leftop != NULL);
...@@ -834,10 +832,10 @@ ExecInitIndexScan(IndexScan *node, EState *estate) ...@@ -834,10 +832,10 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
/* /*
* now determine information in rightop * now determine information in rightop
*/ */
rightop = (Node *) get_rightop(clause); rightop = (Node *) get_rightop((Expr *) clause);
if (rightop && IsA(rightop, RelabelType)) if (rightop && IsA(rightop, RelabelType))
rightop = ((RelabelType *) rightop)->arg; rightop = (Node *) ((RelabelType *) rightop)->arg;
Assert(rightop != NULL); Assert(rightop != NULL);
...@@ -921,7 +919,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate) ...@@ -921,7 +919,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
flags, flags,
varattno, /* attribute number to varattno, /* attribute number to
* scan */ * scan */
(RegProcedure) opid, /* reg proc to use */ opfuncid, /* reg proc to use */
scanvalue); /* constant */ scanvalue); /* constant */
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.52 2002/12/05 15:50:33 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.53 2002/12/12 15:49:25 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -119,16 +119,14 @@ MJFormSkipQuals(List *qualList, List **ltQuals, List **gtQuals) ...@@ -119,16 +119,14 @@ MJFormSkipQuals(List *qualList, List **ltQuals, List **gtQuals)
ltcdr = *ltQuals; ltcdr = *ltQuals;
foreach(gtcdr, *gtQuals) foreach(gtcdr, *gtQuals)
{ {
Expr *ltqual = (Expr *) lfirst(ltcdr); OpExpr *ltop = (OpExpr *) lfirst(ltcdr);
Expr *gtqual = (Expr *) lfirst(gtcdr); OpExpr *gtop = (OpExpr *) lfirst(gtcdr);
Oper *ltop = (Oper *) ltqual->oper;
Oper *gtop = (Oper *) gtqual->oper;
/* /*
* The two ops should be identical, so use either one for lookup. * The two ops should be identical, so use either one for lookup.
*/ */
if (!IsA(ltop, Oper)) if (!IsA(ltop, OpExpr))
elog(ERROR, "MJFormSkipQuals: op not an Oper!"); elog(ERROR, "MJFormSkipQuals: op not an OpExpr!");
/* /*
* Lookup the operators, and replace the data in the copied * Lookup the operators, and replace the data in the copied
...@@ -137,8 +135,8 @@ MJFormSkipQuals(List *qualList, List **ltQuals, List **gtQuals) ...@@ -137,8 +135,8 @@ MJFormSkipQuals(List *qualList, List **ltQuals, List **gtQuals)
op_mergejoin_crossops(ltop->opno, op_mergejoin_crossops(ltop->opno,
&ltop->opno, &ltop->opno,
&gtop->opno, &gtop->opno,
&ltop->opid, &ltop->opfuncid,
&gtop->opid); &gtop->opfuncid);
ltop->op_fcache = NULL; ltop->op_fcache = NULL;
gtop->op_fcache = NULL; gtop->op_fcache = NULL;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.35 2002/12/05 15:50:33 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.36 2002/12/12 15:49:27 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -34,7 +34,7 @@ ExecSubPlan(SubPlanState *node, List *pvar, ...@@ -34,7 +34,7 @@ ExecSubPlan(SubPlanState *node, List *pvar,
ExprContext *econtext, bool *isNull) ExprContext *econtext, bool *isNull)
{ {
PlanState *planstate = node->planstate; PlanState *planstate = node->planstate;
SubPlan *subplan = (SubPlan *) node->ps.plan; SubPlanExpr *subplan = (SubPlanExpr *) node->ps.plan;
SubLink *sublink = subplan->sublink; SubLink *sublink = subplan->sublink;
SubLinkType subLinkType = sublink->subLinkType; SubLinkType subLinkType = sublink->subLinkType;
bool useor = sublink->useor; bool useor = sublink->useor;
...@@ -151,7 +151,7 @@ ExecSubPlan(SubPlanState *node, List *pvar, ...@@ -151,7 +151,7 @@ ExecSubPlan(SubPlanState *node, List *pvar,
*/ */
foreach(lst, sublink->oper) foreach(lst, sublink->oper)
{ {
Expr *expr = (Expr *) lfirst(lst); OpExpr *expr = (OpExpr *) lfirst(lst);
Param *prm = lsecond(expr->args); Param *prm = lsecond(expr->args);
ParamExecData *prmdata; ParamExecData *prmdata;
Datum expresult; Datum expresult;
...@@ -172,8 +172,8 @@ ExecSubPlan(SubPlanState *node, List *pvar, ...@@ -172,8 +172,8 @@ ExecSubPlan(SubPlanState *node, List *pvar,
{ {
switch (nodeTag(prm)) switch (nodeTag(prm))
{ {
case T_Expr: case T_FuncExpr:
prm = lfirst(((Expr *) prm)->args); prm = lfirst(((FuncExpr *) prm)->args);
break; break;
case T_RelabelType: case T_RelabelType:
prm = (Param *) (((RelabelType *) prm)->arg); prm = (Param *) (((RelabelType *) prm)->arg);
...@@ -288,7 +288,7 @@ ExecSubPlan(SubPlanState *node, List *pvar, ...@@ -288,7 +288,7 @@ ExecSubPlan(SubPlanState *node, List *pvar,
* ---------------------------------------------------------------- * ----------------------------------------------------------------
*/ */
SubPlanState * SubPlanState *
ExecInitSubPlan(SubPlan *node, EState *estate) ExecInitSubPlan(SubPlanExpr *node, EState *estate)
{ {
SubPlanState *subplanstate; SubPlanState *subplanstate;
EState *sp_estate; EState *sp_estate;
...@@ -374,7 +374,7 @@ void ...@@ -374,7 +374,7 @@ void
ExecSetParamPlan(SubPlanState *node, ExprContext *econtext) ExecSetParamPlan(SubPlanState *node, ExprContext *econtext)
{ {
PlanState *planstate = node->planstate; PlanState *planstate = node->planstate;
SubPlan *subplan = (SubPlan *) node->ps.plan; SubPlanExpr *subplan = (SubPlanExpr *) node->ps.plan;
SubLink *sublink = subplan->sublink; SubLink *sublink = subplan->sublink;
EState *estate = node->ps.state; EState *estate = node->ps.state;
MemoryContext oldcontext; MemoryContext oldcontext;
...@@ -497,7 +497,7 @@ void ...@@ -497,7 +497,7 @@ void
ExecReScanSetParamPlan(SubPlanState *node, PlanState *parent) ExecReScanSetParamPlan(SubPlanState *node, PlanState *parent)
{ {
PlanState *planstate = node->planstate; PlanState *planstate = node->planstate;
SubPlan *subplan = (SubPlan *) node->ps.plan; SubPlanExpr *subplan = (SubPlanExpr *) node->ps.plan;
EState *estate = node->ps.state; EState *estate = node->ps.state;
List *lst; List *lst;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.229 2002/12/06 05:00:18 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.230 2002/12/12 15:49:28 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -563,21 +563,6 @@ _copyLimit(Limit *from) ...@@ -563,21 +563,6 @@ _copyLimit(Limit *from)
return newnode; return newnode;
} }
static SubPlan *
_copySubPlan(SubPlan *from)
{
SubPlan *newnode = makeNode(SubPlan);
COPY_NODE_FIELD(plan);
COPY_SCALAR_FIELD(plan_id);
COPY_NODE_FIELD(rtable);
COPY_INTLIST_FIELD(setParam);
COPY_INTLIST_FIELD(parParam);
COPY_NODE_FIELD(sublink);
return newnode;
}
/* **************************************************************** /* ****************************************************************
* primnodes.h copy functions * primnodes.h copy functions
* **************************************************************** * ****************************************************************
...@@ -603,20 +588,9 @@ _copyResdom(Resdom *from) ...@@ -603,20 +588,9 @@ _copyResdom(Resdom *from)
return newnode; return newnode;
} }
static Fjoin * /*
_copyFjoin(Fjoin *from) * _copyAlias
{ */
Fjoin *newnode = makeNode(Fjoin);
COPY_SCALAR_FIELD(fj_initialized);
COPY_SCALAR_FIELD(fj_nNodes);
COPY_NODE_FIELD(fj_innerNode);
COPY_POINTER_FIELD(fj_results, from->fj_nNodes * sizeof(Datum));
COPY_POINTER_FIELD(fj_alwaysDone, from->fj_nNodes * sizeof(bool));
return newnode;
}
static Alias * static Alias *
_copyAlias(Alias *from) _copyAlias(Alias *from)
{ {
...@@ -628,6 +602,9 @@ _copyAlias(Alias *from) ...@@ -628,6 +602,9 @@ _copyAlias(Alias *from)
return newnode; return newnode;
} }
/*
* _copyRangeVar
*/
static RangeVar * static RangeVar *
_copyRangeVar(RangeVar *from) _copyRangeVar(RangeVar *from)
{ {
...@@ -644,20 +621,11 @@ _copyRangeVar(RangeVar *from) ...@@ -644,20 +621,11 @@ _copyRangeVar(RangeVar *from)
} }
/* /*
* _copyExpr * We don't need a _copyExpr because Expr is an abstract supertype which
* should never actually get instantiated. Also, since it has no common
* fields except NodeTag, there's no need for a helper routine to factor
* out copying the common fields...
*/ */
static Expr *
_copyExpr(Expr *from)
{
Expr *newnode = makeNode(Expr);
COPY_SCALAR_FIELD(typeOid);
COPY_SCALAR_FIELD(opType);
COPY_NODE_FIELD(oper);
COPY_NODE_FIELD(args);
return newnode;
}
/* /*
* _copyVar * _copyVar
...@@ -678,25 +646,6 @@ _copyVar(Var *from) ...@@ -678,25 +646,6 @@ _copyVar(Var *from)
return newnode; return newnode;
} }
/*
* _copyOper
*/
static Oper *
_copyOper(Oper *from)
{
Oper *newnode = makeNode(Oper);
COPY_SCALAR_FIELD(opno);
COPY_SCALAR_FIELD(opid);
COPY_SCALAR_FIELD(opresulttype);
COPY_SCALAR_FIELD(opretset);
/* Do not copy the run-time state, if any */
newnode->op_fcache = NULL;
return newnode;
}
/* /*
* _copyConst * _copyConst
*/ */
...@@ -749,17 +698,57 @@ _copyParam(Param *from) ...@@ -749,17 +698,57 @@ _copyParam(Param *from)
} }
/* /*
* _copyFunc * _copyAggref
*/ */
static Func * static Aggref *
_copyFunc(Func *from) _copyAggref(Aggref *from)
{ {
Func *newnode = makeNode(Func); Aggref *newnode = makeNode(Aggref);
COPY_SCALAR_FIELD(aggfnoid);
COPY_SCALAR_FIELD(aggtype);
COPY_NODE_FIELD(target);
COPY_SCALAR_FIELD(aggstar);
COPY_SCALAR_FIELD(aggdistinct);
COPY_SCALAR_FIELD(aggno); /* will go away soon */
return newnode;
}
/*
* _copyArrayRef
*/
static ArrayRef *
_copyArrayRef(ArrayRef *from)
{
ArrayRef *newnode = makeNode(ArrayRef);
COPY_SCALAR_FIELD(refrestype);
COPY_SCALAR_FIELD(refattrlength);
COPY_SCALAR_FIELD(refelemlength);
COPY_SCALAR_FIELD(refelembyval);
COPY_SCALAR_FIELD(refelemalign);
COPY_NODE_FIELD(refupperindexpr);
COPY_NODE_FIELD(reflowerindexpr);
COPY_NODE_FIELD(refexpr);
COPY_NODE_FIELD(refassgnexpr);
return newnode;
}
/*
* _copyFuncExpr
*/
static FuncExpr *
_copyFuncExpr(FuncExpr *from)
{
FuncExpr *newnode = makeNode(FuncExpr);
COPY_SCALAR_FIELD(funcid); COPY_SCALAR_FIELD(funcid);
COPY_SCALAR_FIELD(funcresulttype); COPY_SCALAR_FIELD(funcresulttype);
COPY_SCALAR_FIELD(funcretset); COPY_SCALAR_FIELD(funcretset);
COPY_SCALAR_FIELD(funcformat); COPY_SCALAR_FIELD(funcformat);
COPY_NODE_FIELD(args);
/* Do not copy the run-time state, if any */ /* Do not copy the run-time state, if any */
newnode->func_fcache = NULL; newnode->func_fcache = NULL;
...@@ -768,19 +757,55 @@ _copyFunc(Func *from) ...@@ -768,19 +757,55 @@ _copyFunc(Func *from)
} }
/* /*
* _copyAggref * _copyOpExpr
*/ */
static Aggref * static OpExpr *
_copyAggref(Aggref *from) _copyOpExpr(OpExpr *from)
{ {
Aggref *newnode = makeNode(Aggref); OpExpr *newnode = makeNode(OpExpr);
COPY_SCALAR_FIELD(aggfnoid); COPY_SCALAR_FIELD(opno);
COPY_SCALAR_FIELD(aggtype); COPY_SCALAR_FIELD(opfuncid);
COPY_NODE_FIELD(target); COPY_SCALAR_FIELD(opresulttype);
COPY_SCALAR_FIELD(aggstar); COPY_SCALAR_FIELD(opretset);
COPY_SCALAR_FIELD(aggdistinct); COPY_NODE_FIELD(args);
COPY_SCALAR_FIELD(aggno); /* probably not necessary */
/* Do not copy the run-time state, if any */
newnode->op_fcache = NULL;
return newnode;
}
/*
* _copyDistinctExpr
*/
static DistinctExpr *
_copyDistinctExpr(DistinctExpr *from)
{
DistinctExpr *newnode = makeNode(DistinctExpr);
COPY_SCALAR_FIELD(opno);
COPY_SCALAR_FIELD(opfuncid);
COPY_SCALAR_FIELD(opresulttype);
COPY_SCALAR_FIELD(opretset);
COPY_NODE_FIELD(args);
/* Do not copy the run-time state, if any */
newnode->op_fcache = NULL;
return newnode;
}
/*
* _copyBoolExpr
*/
static BoolExpr *
_copyBoolExpr(BoolExpr *from)
{
BoolExpr *newnode = makeNode(BoolExpr);
COPY_SCALAR_FIELD(boolop);
COPY_NODE_FIELD(args);
return newnode; return newnode;
} }
...@@ -802,6 +827,26 @@ _copySubLink(SubLink *from) ...@@ -802,6 +827,26 @@ _copySubLink(SubLink *from)
return newnode; return newnode;
} }
/*
* _copySubPlanExpr
*/
static SubPlanExpr *
_copySubPlanExpr(SubPlanExpr *from)
{
SubPlanExpr *newnode = makeNode(SubPlanExpr);
COPY_SCALAR_FIELD(typeOid);
COPY_NODE_FIELD(plan);
COPY_SCALAR_FIELD(plan_id);
COPY_NODE_FIELD(rtable);
COPY_INTLIST_FIELD(setParam);
COPY_INTLIST_FIELD(parParam);
COPY_NODE_FIELD(args);
COPY_NODE_FIELD(sublink);
return newnode;
}
/* /*
* _copyFieldSelect * _copyFieldSelect
*/ */
...@@ -834,6 +879,112 @@ _copyRelabelType(RelabelType *from) ...@@ -834,6 +879,112 @@ _copyRelabelType(RelabelType *from)
return newnode; return newnode;
} }
/*
* _copyCaseExpr
*/
static CaseExpr *
_copyCaseExpr(CaseExpr *from)
{
CaseExpr *newnode = makeNode(CaseExpr);
COPY_SCALAR_FIELD(casetype);
COPY_NODE_FIELD(arg);
COPY_NODE_FIELD(args);
COPY_NODE_FIELD(defresult);
return newnode;
}
/*
* _copyCaseWhen
*/
static CaseWhen *
_copyCaseWhen(CaseWhen *from)
{
CaseWhen *newnode = makeNode(CaseWhen);
COPY_NODE_FIELD(expr);
COPY_NODE_FIELD(result);
return newnode;
}
/*
* _copyNullTest
*/
static NullTest *
_copyNullTest(NullTest *from)
{
NullTest *newnode = makeNode(NullTest);
COPY_NODE_FIELD(arg);
COPY_SCALAR_FIELD(nulltesttype);
return newnode;
}
/*
* _copyBooleanTest
*/
static BooleanTest *
_copyBooleanTest(BooleanTest *from)
{
BooleanTest *newnode = makeNode(BooleanTest);
COPY_NODE_FIELD(arg);
COPY_SCALAR_FIELD(booltesttype);
return newnode;
}
/*
* _copyConstraintTest
*/
static ConstraintTest *
_copyConstraintTest(ConstraintTest *from)
{
ConstraintTest *newnode = makeNode(ConstraintTest);
COPY_NODE_FIELD(arg);
COPY_SCALAR_FIELD(testtype);
COPY_STRING_FIELD(name);
COPY_STRING_FIELD(domname);
COPY_NODE_FIELD(check_expr);
return newnode;
}
/*
* _copyConstraintTestValue
*/
static ConstraintTestValue *
_copyConstraintTestValue(ConstraintTestValue *from)
{
ConstraintTestValue *newnode = makeNode(ConstraintTestValue);
COPY_SCALAR_FIELD(typeId);
COPY_SCALAR_FIELD(typeMod);
return newnode;
}
/*
* _copyTargetEntry
*/
static TargetEntry *
_copyTargetEntry(TargetEntry *from)
{
TargetEntry *newnode = makeNode(TargetEntry);
COPY_NODE_FIELD(resdom);
COPY_NODE_FIELD(expr);
return newnode;
}
/*
* _copyRangeTblRef
*/
static RangeTblRef * static RangeTblRef *
_copyRangeTblRef(RangeTblRef *from) _copyRangeTblRef(RangeTblRef *from)
{ {
...@@ -844,6 +995,9 @@ _copyRangeTblRef(RangeTblRef *from) ...@@ -844,6 +995,9 @@ _copyRangeTblRef(RangeTblRef *from)
return newnode; return newnode;
} }
/*
* _copyJoinExpr
*/
static JoinExpr * static JoinExpr *
_copyJoinExpr(JoinExpr *from) _copyJoinExpr(JoinExpr *from)
{ {
...@@ -861,6 +1015,9 @@ _copyJoinExpr(JoinExpr *from) ...@@ -861,6 +1015,9 @@ _copyJoinExpr(JoinExpr *from)
return newnode; return newnode;
} }
/*
* _copyFromExpr
*/
static FromExpr * static FromExpr *
_copyFromExpr(FromExpr *from) _copyFromExpr(FromExpr *from)
{ {
...@@ -872,24 +1029,6 @@ _copyFromExpr(FromExpr *from) ...@@ -872,24 +1029,6 @@ _copyFromExpr(FromExpr *from)
return newnode; return newnode;
} }
static ArrayRef *
_copyArrayRef(ArrayRef *from)
{
ArrayRef *newnode = makeNode(ArrayRef);
COPY_SCALAR_FIELD(refrestype);
COPY_SCALAR_FIELD(refattrlength);
COPY_SCALAR_FIELD(refelemlength);
COPY_SCALAR_FIELD(refelembyval);
COPY_SCALAR_FIELD(refelemalign);
COPY_NODE_FIELD(refupperindexpr);
COPY_NODE_FIELD(reflowerindexpr);
COPY_NODE_FIELD(refexpr);
COPY_NODE_FIELD(refassgnexpr);
return newnode;
}
/* **************************************************************** /* ****************************************************************
* relation.h copy functions * relation.h copy functions
* *
...@@ -964,18 +1103,6 @@ _copyJoinInfo(JoinInfo *from) ...@@ -964,18 +1103,6 @@ _copyJoinInfo(JoinInfo *from)
* **************************************************************** * ****************************************************************
*/ */
static TargetEntry *
_copyTargetEntry(TargetEntry *from)
{
TargetEntry *newnode = makeNode(TargetEntry);
COPY_NODE_FIELD(resdom);
COPY_NODE_FIELD(fjoin);
COPY_NODE_FIELD(expr);
return newnode;
}
static RangeTblEntry * static RangeTblEntry *
_copyRangeTblEntry(RangeTblEntry *from) _copyRangeTblEntry(RangeTblEntry *from)
{ {
...@@ -1170,6 +1297,14 @@ _copyTypeName(TypeName *from) ...@@ -1170,6 +1297,14 @@ _copyTypeName(TypeName *from)
return newnode; return newnode;
} }
static DomainConstraintValue *
_copyDomainConstraintValue(DomainConstraintValue *from)
{
DomainConstraintValue *newnode = makeNode(DomainConstraintValue);
return newnode;
}
static SortGroupBy * static SortGroupBy *
_copySortGroupBy(SortGroupBy *from) _copySortGroupBy(SortGroupBy *from)
{ {
...@@ -1260,85 +1395,6 @@ _copyConstraint(Constraint *from) ...@@ -1260,85 +1395,6 @@ _copyConstraint(Constraint *from)
return newnode; return newnode;
} }
static CaseExpr *
_copyCaseExpr(CaseExpr *from)
{
CaseExpr *newnode = makeNode(CaseExpr);
COPY_SCALAR_FIELD(casetype);
COPY_NODE_FIELD(arg);
COPY_NODE_FIELD(args);
COPY_NODE_FIELD(defresult);
return newnode;
}
static CaseWhen *
_copyCaseWhen(CaseWhen *from)
{
CaseWhen *newnode = makeNode(CaseWhen);
COPY_NODE_FIELD(expr);
COPY_NODE_FIELD(result);
return newnode;
}
static NullTest *
_copyNullTest(NullTest *from)
{
NullTest *newnode = makeNode(NullTest);
COPY_NODE_FIELD(arg);
COPY_SCALAR_FIELD(nulltesttype);
return newnode;
}
static BooleanTest *
_copyBooleanTest(BooleanTest *from)
{
BooleanTest *newnode = makeNode(BooleanTest);
COPY_NODE_FIELD(arg);
COPY_SCALAR_FIELD(booltesttype);
return newnode;
}
static ConstraintTest *
_copyConstraintTest(ConstraintTest *from)
{
ConstraintTest *newnode = makeNode(ConstraintTest);
COPY_NODE_FIELD(arg);
COPY_SCALAR_FIELD(testtype);
COPY_STRING_FIELD(name);
COPY_STRING_FIELD(domname);
COPY_NODE_FIELD(check_expr);
return newnode;
}
static DomainConstraintValue *
_copyDomainConstraintValue(DomainConstraintValue *from)
{
DomainConstraintValue *newnode = makeNode(DomainConstraintValue);
return newnode;
}
static ConstraintTestValue *
_copyConstraintTestValue(ConstraintTestValue *from)
{
ConstraintTestValue *newnode = makeNode(ConstraintTestValue);
COPY_SCALAR_FIELD(typeId);
COPY_SCALAR_FIELD(typeMod);
return newnode;
}
static DefElem * static DefElem *
_copyDefElem(DefElem *from) _copyDefElem(DefElem *from)
{ {
...@@ -2350,9 +2406,6 @@ copyObject(void *from) ...@@ -2350,9 +2406,6 @@ copyObject(void *from)
case T_Limit: case T_Limit:
retval = _copyLimit(from); retval = _copyLimit(from);
break; break;
case T_SubPlan:
retval = _copySubPlan(from);
break;
/* /*
* PRIMITIVE NODES * PRIMITIVE NODES
...@@ -2360,45 +2413,72 @@ copyObject(void *from) ...@@ -2360,45 +2413,72 @@ copyObject(void *from)
case T_Resdom: case T_Resdom:
retval = _copyResdom(from); retval = _copyResdom(from);
break; break;
case T_Fjoin:
retval = _copyFjoin(from);
break;
case T_Alias: case T_Alias:
retval = _copyAlias(from); retval = _copyAlias(from);
break; break;
case T_RangeVar: case T_RangeVar:
retval = _copyRangeVar(from); retval = _copyRangeVar(from);
break; break;
case T_Expr:
retval = _copyExpr(from);
break;
case T_Var: case T_Var:
retval = _copyVar(from); retval = _copyVar(from);
break; break;
case T_Oper:
retval = _copyOper(from);
break;
case T_Const: case T_Const:
retval = _copyConst(from); retval = _copyConst(from);
break; break;
case T_Param: case T_Param:
retval = _copyParam(from); retval = _copyParam(from);
break; break;
case T_Func:
retval = _copyFunc(from);
break;
case T_Aggref: case T_Aggref:
retval = _copyAggref(from); retval = _copyAggref(from);
break; break;
case T_ArrayRef:
retval = _copyArrayRef(from);
break;
case T_FuncExpr:
retval = _copyFuncExpr(from);
break;
case T_OpExpr:
retval = _copyOpExpr(from);
break;
case T_DistinctExpr:
retval = _copyDistinctExpr(from);
break;
case T_BoolExpr:
retval = _copyBoolExpr(from);
break;
case T_SubLink: case T_SubLink:
retval = _copySubLink(from); retval = _copySubLink(from);
break; break;
case T_SubPlanExpr:
retval = _copySubPlanExpr(from);
break;
case T_FieldSelect: case T_FieldSelect:
retval = _copyFieldSelect(from); retval = _copyFieldSelect(from);
break; break;
case T_RelabelType: case T_RelabelType:
retval = _copyRelabelType(from); retval = _copyRelabelType(from);
break; break;
case T_CaseExpr:
retval = _copyCaseExpr(from);
break;
case T_CaseWhen:
retval = _copyCaseWhen(from);
break;
case T_NullTest:
retval = _copyNullTest(from);
break;
case T_BooleanTest:
retval = _copyBooleanTest(from);
break;
case T_ConstraintTest:
retval = _copyConstraintTest(from);
break;
case T_ConstraintTestValue:
retval = _copyConstraintTestValue(from);
break;
case T_TargetEntry:
retval = _copyTargetEntry(from);
break;
case T_RangeTblRef: case T_RangeTblRef:
retval = _copyRangeTblRef(from); retval = _copyRangeTblRef(from);
break; break;
...@@ -2408,9 +2488,6 @@ copyObject(void *from) ...@@ -2408,9 +2488,6 @@ copyObject(void *from)
case T_FromExpr: case T_FromExpr:
retval = _copyFromExpr(from); retval = _copyFromExpr(from);
break; break;
case T_ArrayRef:
retval = _copyArrayRef(from);
break;
/* /*
* RELATION NODES * RELATION NODES
...@@ -2686,6 +2763,9 @@ copyObject(void *from) ...@@ -2686,6 +2763,9 @@ copyObject(void *from)
case T_TypeCast: case T_TypeCast:
retval = _copyTypeCast(from); retval = _copyTypeCast(from);
break; break;
case T_DomainConstraintValue:
retval = _copyDomainConstraintValue(from);
break;
case T_SortGroupBy: case T_SortGroupBy:
retval = _copySortGroupBy(from); retval = _copySortGroupBy(from);
break; break;
...@@ -2710,9 +2790,6 @@ copyObject(void *from) ...@@ -2710,9 +2790,6 @@ copyObject(void *from)
case T_DefElem: case T_DefElem:
retval = _copyDefElem(from); retval = _copyDefElem(from);
break; break;
case T_TargetEntry:
retval = _copyTargetEntry(from);
break;
case T_RangeTblEntry: case T_RangeTblEntry:
retval = _copyRangeTblEntry(from); retval = _copyRangeTblEntry(from);
break; break;
...@@ -2722,24 +2799,6 @@ copyObject(void *from) ...@@ -2722,24 +2799,6 @@ copyObject(void *from)
case T_GroupClause: case T_GroupClause:
retval = _copyGroupClause(from); retval = _copyGroupClause(from);
break; break;
case T_CaseExpr:
retval = _copyCaseExpr(from);
break;
case T_CaseWhen:
retval = _copyCaseWhen(from);
break;
case T_NullTest:
retval = _copyNullTest(from);
break;
case T_BooleanTest:
retval = _copyBooleanTest(from);
break;
case T_ConstraintTest:
retval = _copyConstraintTest(from);
break;
case T_ConstraintTestValue:
retval = _copyConstraintTestValue(from);
break;
case T_FkConstraint: case T_FkConstraint:
retval = _copyFkConstraint(from); retval = _copyFkConstraint(from);
break; break;
...@@ -2752,9 +2811,6 @@ copyObject(void *from) ...@@ -2752,9 +2811,6 @@ copyObject(void *from)
case T_InsertDefault: case T_InsertDefault:
retval = _copyInsertDefault(from); retval = _copyInsertDefault(from);
break; break;
case T_DomainConstraintValue:
retval = _copyDomainConstraintValue(from);
break;
default: default:
elog(ERROR, "copyObject: don't know how to copy node type %d", elog(ERROR, "copyObject: don't know how to copy node type %d",
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.174 2002/12/06 05:00:18 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.175 2002/12/12 15:49:28 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "nodes/params.h" #include "nodes/params.h"
#include "nodes/parsenodes.h" #include "nodes/parsenodes.h"
#include "nodes/plannodes.h"
#include "nodes/relation.h" #include "nodes/relation.h"
#include "utils/datum.h" #include "utils/datum.h"
...@@ -98,18 +97,6 @@ _equalResdom(Resdom *a, Resdom *b) ...@@ -98,18 +97,6 @@ _equalResdom(Resdom *a, Resdom *b)
return true; return true;
} }
static bool
_equalFjoin(Fjoin *a, Fjoin *b)
{
COMPARE_SCALAR_FIELD(fj_initialized);
COMPARE_SCALAR_FIELD(fj_nNodes);
COMPARE_NODE_FIELD(fj_innerNode);
COMPARE_POINTER_FIELD(fj_results, a->fj_nNodes * sizeof(Datum));
COMPARE_POINTER_FIELD(fj_alwaysDone, a->fj_nNodes * sizeof(bool));
return true;
}
static bool static bool
_equalAlias(Alias *a, Alias *b) _equalAlias(Alias *a, Alias *b)
{ {
...@@ -132,20 +119,12 @@ _equalRangeVar(RangeVar *a, RangeVar *b) ...@@ -132,20 +119,12 @@ _equalRangeVar(RangeVar *a, RangeVar *b)
return true; return true;
} }
static bool /*
_equalExpr(Expr *a, Expr *b) * We don't need an _equalExpr because Expr is an abstract supertype which
{ * should never actually get instantiated. Also, since it has no common
/* * fields except NodeTag, there's no need for a helper routine to factor
* We do not examine typeOid, since the optimizer often doesn't bother * out comparing the common fields...
* to set it in created nodes, and it is logically a derivative of the
* oper field anyway.
*/ */
COMPARE_SCALAR_FIELD(opType);
COMPARE_NODE_FIELD(oper);
COMPARE_NODE_FIELD(args);
return true;
}
static bool static bool
_equalVar(Var *a, Var *b) _equalVar(Var *a, Var *b)
...@@ -161,28 +140,6 @@ _equalVar(Var *a, Var *b) ...@@ -161,28 +140,6 @@ _equalVar(Var *a, Var *b)
return true; return true;
} }
static bool
_equalOper(Oper *a, Oper *b)
{
COMPARE_SCALAR_FIELD(opno);
COMPARE_SCALAR_FIELD(opresulttype);
COMPARE_SCALAR_FIELD(opretset);
/*
* We do not examine opid or op_fcache, since these are logically
* derived from opno, and they may not be set yet depending on how far
* along the node is in the parse/plan pipeline.
*
* (Besides, op_fcache is executor state, which we don't check --- see
* notes at head of file.)
*
* It's probably not really necessary to check opresulttype or opretset,
* either...
*/
return true;
}
static bool static bool
_equalConst(Const *a, Const *b) _equalConst(Const *a, Const *b)
{ {
...@@ -226,7 +183,35 @@ _equalParam(Param *a, Param *b) ...@@ -226,7 +183,35 @@ _equalParam(Param *a, Param *b)
} }
static bool static bool
_equalFunc(Func *a, Func *b) _equalAggref(Aggref *a, Aggref *b)
{
COMPARE_SCALAR_FIELD(aggfnoid);
COMPARE_SCALAR_FIELD(aggtype);
COMPARE_NODE_FIELD(target);
COMPARE_SCALAR_FIELD(aggstar);
COMPARE_SCALAR_FIELD(aggdistinct);
return true;
}
static bool
_equalArrayRef(ArrayRef *a, ArrayRef *b)
{
COMPARE_SCALAR_FIELD(refrestype);
COMPARE_SCALAR_FIELD(refattrlength);
COMPARE_SCALAR_FIELD(refelemlength);
COMPARE_SCALAR_FIELD(refelembyval);
COMPARE_SCALAR_FIELD(refelemalign);
COMPARE_NODE_FIELD(refupperindexpr);
COMPARE_NODE_FIELD(reflowerindexpr);
COMPARE_NODE_FIELD(refexpr);
COMPARE_NODE_FIELD(refassgnexpr);
return true;
}
static bool
_equalFuncExpr(FuncExpr *a, FuncExpr *b)
{ {
COMPARE_SCALAR_FIELD(funcid); COMPARE_SCALAR_FIELD(funcid);
COMPARE_SCALAR_FIELD(funcresulttype); COMPARE_SCALAR_FIELD(funcresulttype);
...@@ -240,20 +225,60 @@ _equalFunc(Func *a, Func *b) ...@@ -240,20 +225,60 @@ _equalFunc(Func *a, Func *b)
b->funcformat != COERCE_DONTCARE) b->funcformat != COERCE_DONTCARE)
return false; return false;
/* Note we do not look at func_fcache; see notes for _equalOper */ COMPARE_NODE_FIELD(args);
return true; return true;
} }
static bool static bool
_equalAggref(Aggref *a, Aggref *b) _equalOpExpr(OpExpr *a, OpExpr *b)
{ {
COMPARE_SCALAR_FIELD(aggfnoid); COMPARE_SCALAR_FIELD(opno);
COMPARE_SCALAR_FIELD(aggtype); /*
COMPARE_NODE_FIELD(target); * Special-case opfuncid: it is allowable for it to differ if one
COMPARE_SCALAR_FIELD(aggstar); * node contains zero and the other doesn't. This just means that the
COMPARE_SCALAR_FIELD(aggdistinct); * one node isn't as far along in the parse/plan pipeline and hasn't
/* ignore aggno, which is only a private field for the executor */ * had the opfuncid cache filled yet.
*/
if (a->opfuncid != b->opfuncid &&
a->opfuncid != 0 &&
b->opfuncid != 0)
return false;
COMPARE_SCALAR_FIELD(opresulttype);
COMPARE_SCALAR_FIELD(opretset);
COMPARE_NODE_FIELD(args);
return true;
}
static bool
_equalDistinctExpr(DistinctExpr *a, DistinctExpr *b)
{
COMPARE_SCALAR_FIELD(opno);
/*
* Special-case opfuncid: it is allowable for it to differ if one
* node contains zero and the other doesn't. This just means that the
* one node isn't as far along in the parse/plan pipeline and hasn't
* had the opfuncid cache filled yet.
*/
if (a->opfuncid != b->opfuncid &&
a->opfuncid != 0 &&
b->opfuncid != 0)
return false;
COMPARE_SCALAR_FIELD(opresulttype);
COMPARE_SCALAR_FIELD(opretset);
COMPARE_NODE_FIELD(args);
return true;
}
static bool
_equalBoolExpr(BoolExpr *a, BoolExpr *b)
{
COMPARE_SCALAR_FIELD(boolop);
COMPARE_NODE_FIELD(args);
return true; return true;
} }
...@@ -270,6 +295,21 @@ _equalSubLink(SubLink *a, SubLink *b) ...@@ -270,6 +295,21 @@ _equalSubLink(SubLink *a, SubLink *b)
return true; return true;
} }
static bool
_equalSubPlanExpr(SubPlanExpr *a, SubPlanExpr *b)
{
COMPARE_SCALAR_FIELD(typeOid);
/* should compare plans, but have to settle for comparing plan IDs */
COMPARE_SCALAR_FIELD(plan_id);
COMPARE_NODE_FIELD(rtable);
COMPARE_INTLIST_FIELD(setParam);
COMPARE_INTLIST_FIELD(parParam);
COMPARE_NODE_FIELD(args);
COMPARE_NODE_FIELD(sublink);
return true;
}
static bool static bool
_equalFieldSelect(FieldSelect *a, FieldSelect *b) _equalFieldSelect(FieldSelect *a, FieldSelect *b)
{ {
...@@ -300,66 +340,101 @@ _equalRelabelType(RelabelType *a, RelabelType *b) ...@@ -300,66 +340,101 @@ _equalRelabelType(RelabelType *a, RelabelType *b)
} }
static bool static bool
_equalRangeTblRef(RangeTblRef *a, RangeTblRef *b) _equalCaseExpr(CaseExpr *a, CaseExpr *b)
{ {
COMPARE_SCALAR_FIELD(rtindex); COMPARE_SCALAR_FIELD(casetype);
COMPARE_NODE_FIELD(arg);
COMPARE_NODE_FIELD(args);
COMPARE_NODE_FIELD(defresult);
return true; return true;
} }
static bool static bool
_equalJoinExpr(JoinExpr *a, JoinExpr *b) _equalCaseWhen(CaseWhen *a, CaseWhen *b)
{ {
COMPARE_SCALAR_FIELD(jointype); COMPARE_NODE_FIELD(expr);
COMPARE_SCALAR_FIELD(isNatural); COMPARE_NODE_FIELD(result);
COMPARE_NODE_FIELD(larg);
COMPARE_NODE_FIELD(rarg);
COMPARE_NODE_FIELD(using);
COMPARE_NODE_FIELD(quals);
COMPARE_NODE_FIELD(alias);
COMPARE_SCALAR_FIELD(rtindex);
return true; return true;
} }
static bool static bool
_equalFromExpr(FromExpr *a, FromExpr *b) _equalNullTest(NullTest *a, NullTest *b)
{ {
COMPARE_NODE_FIELD(fromlist); COMPARE_NODE_FIELD(arg);
COMPARE_NODE_FIELD(quals); COMPARE_SCALAR_FIELD(nulltesttype);
return true; return true;
} }
static bool static bool
_equalArrayRef(ArrayRef *a, ArrayRef *b) _equalBooleanTest(BooleanTest *a, BooleanTest *b)
{ {
COMPARE_SCALAR_FIELD(refrestype); COMPARE_NODE_FIELD(arg);
COMPARE_SCALAR_FIELD(refattrlength); COMPARE_SCALAR_FIELD(booltesttype);
COMPARE_SCALAR_FIELD(refelemlength);
COMPARE_SCALAR_FIELD(refelembyval);
COMPARE_SCALAR_FIELD(refelemalign);
COMPARE_NODE_FIELD(refupperindexpr);
COMPARE_NODE_FIELD(reflowerindexpr);
COMPARE_NODE_FIELD(refexpr);
COMPARE_NODE_FIELD(refassgnexpr);
return true; return true;
} }
static bool
_equalConstraintTest(ConstraintTest *a, ConstraintTest *b)
{
COMPARE_NODE_FIELD(arg);
COMPARE_SCALAR_FIELD(testtype);
COMPARE_STRING_FIELD(name);
COMPARE_STRING_FIELD(domname);
COMPARE_NODE_FIELD(check_expr);
return true;
}
/* static bool
* Stuff from plannodes.h _equalConstraintTestValue(ConstraintTestValue *a, ConstraintTestValue *b)
*/ {
COMPARE_SCALAR_FIELD(typeId);
COMPARE_SCALAR_FIELD(typeMod);
return true;
}
static bool static bool
_equalSubPlan(SubPlan *a, SubPlan *b) _equalTargetEntry(TargetEntry *a, TargetEntry *b)
{ {
/* should compare plans, but have to settle for comparing plan IDs */ COMPARE_NODE_FIELD(resdom);
COMPARE_SCALAR_FIELD(plan_id); COMPARE_NODE_FIELD(expr);
COMPARE_NODE_FIELD(rtable); return true;
COMPARE_NODE_FIELD(sublink); }
static bool
_equalRangeTblRef(RangeTblRef *a, RangeTblRef *b)
{
COMPARE_SCALAR_FIELD(rtindex);
return true;
}
static bool
_equalJoinExpr(JoinExpr *a, JoinExpr *b)
{
COMPARE_SCALAR_FIELD(jointype);
COMPARE_SCALAR_FIELD(isNatural);
COMPARE_NODE_FIELD(larg);
COMPARE_NODE_FIELD(rarg);
COMPARE_NODE_FIELD(using);
COMPARE_NODE_FIELD(quals);
COMPARE_NODE_FIELD(alias);
COMPARE_SCALAR_FIELD(rtindex);
return true;
}
static bool
_equalFromExpr(FromExpr *a, FromExpr *b)
{
COMPARE_NODE_FIELD(fromlist);
COMPARE_NODE_FIELD(quals);
return true; return true;
} }
...@@ -573,6 +648,12 @@ _equalInsertDefault(InsertDefault *a, InsertDefault *b) ...@@ -573,6 +648,12 @@ _equalInsertDefault(InsertDefault *a, InsertDefault *b)
return true; return true;
} }
static bool
_equalDomainConstraintValue(DomainConstraintValue *a, DomainConstraintValue *b)
{
return true;
}
static bool static bool
_equalClosePortalStmt(ClosePortalStmt *a, ClosePortalStmt *b) _equalClosePortalStmt(ClosePortalStmt *a, ClosePortalStmt *b)
{ {
...@@ -1340,16 +1421,6 @@ _equalDefElem(DefElem *a, DefElem *b) ...@@ -1340,16 +1421,6 @@ _equalDefElem(DefElem *a, DefElem *b)
return true; return true;
} }
static bool
_equalTargetEntry(TargetEntry *a, TargetEntry *b)
{
COMPARE_NODE_FIELD(resdom);
COMPARE_NODE_FIELD(fjoin);
COMPARE_NODE_FIELD(expr);
return true;
}
static bool static bool
_equalRangeTblEntry(RangeTblEntry *a, RangeTblEntry *b) _equalRangeTblEntry(RangeTblEntry *a, RangeTblEntry *b)
{ {
...@@ -1397,71 +1468,6 @@ _equalFkConstraint(FkConstraint *a, FkConstraint *b) ...@@ -1397,71 +1468,6 @@ _equalFkConstraint(FkConstraint *a, FkConstraint *b)
return true; return true;
} }
static bool
_equalCaseExpr(CaseExpr *a, CaseExpr *b)
{
COMPARE_SCALAR_FIELD(casetype);
COMPARE_NODE_FIELD(arg);
COMPARE_NODE_FIELD(args);
COMPARE_NODE_FIELD(defresult);
return true;
}
static bool
_equalCaseWhen(CaseWhen *a, CaseWhen *b)
{
COMPARE_NODE_FIELD(expr);
COMPARE_NODE_FIELD(result);
return true;
}
static bool
_equalNullTest(NullTest *a, NullTest *b)
{
COMPARE_NODE_FIELD(arg);
COMPARE_SCALAR_FIELD(nulltesttype);
return true;
}
static bool
_equalBooleanTest(BooleanTest *a, BooleanTest *b)
{
COMPARE_NODE_FIELD(arg);
COMPARE_SCALAR_FIELD(booltesttype);
return true;
}
static bool
_equalConstraintTest(ConstraintTest *a, ConstraintTest *b)
{
COMPARE_NODE_FIELD(arg);
COMPARE_SCALAR_FIELD(testtype);
COMPARE_STRING_FIELD(name);
COMPARE_STRING_FIELD(domname);
COMPARE_NODE_FIELD(check_expr);
return true;
}
static bool
_equalDomainConstraintValue(DomainConstraintValue *a, DomainConstraintValue *b)
{
return true;
}
static bool
_equalConstraintTestValue(ConstraintTestValue *a, ConstraintTestValue *b)
{
COMPARE_SCALAR_FIELD(typeId);
COMPARE_SCALAR_FIELD(typeMod);
return true;
}
/* /*
* Stuff from pg_list.h * Stuff from pg_list.h
...@@ -1519,25 +1525,21 @@ equal(void *a, void *b) ...@@ -1519,25 +1525,21 @@ equal(void *a, void *b)
switch (nodeTag(a)) switch (nodeTag(a))
{ {
case T_SubPlan: /*
retval = _equalSubPlan(a, b); * PRIMITIVE NODES
break; */
case T_Resdom: case T_Resdom:
retval = _equalResdom(a, b); retval = _equalResdom(a, b);
break; break;
case T_Fjoin: case T_Alias:
retval = _equalFjoin(a, b); retval = _equalAlias(a, b);
break; break;
case T_Expr: case T_RangeVar:
retval = _equalExpr(a, b); retval = _equalRangeVar(a, b);
break; break;
case T_Var: case T_Var:
retval = _equalVar(a, b); retval = _equalVar(a, b);
break; break;
case T_Oper:
retval = _equalOper(a, b);
break;
case T_Const: case T_Const:
retval = _equalConst(a, b); retval = _equalConst(a, b);
break; break;
...@@ -1547,21 +1549,54 @@ equal(void *a, void *b) ...@@ -1547,21 +1549,54 @@ equal(void *a, void *b)
case T_Aggref: case T_Aggref:
retval = _equalAggref(a, b); retval = _equalAggref(a, b);
break; break;
case T_ArrayRef:
retval = _equalArrayRef(a, b);
break;
case T_FuncExpr:
retval = _equalFuncExpr(a, b);
break;
case T_OpExpr:
retval = _equalOpExpr(a, b);
break;
case T_DistinctExpr:
retval = _equalDistinctExpr(a, b);
break;
case T_BoolExpr:
retval = _equalBoolExpr(a, b);
break;
case T_SubLink: case T_SubLink:
retval = _equalSubLink(a, b); retval = _equalSubLink(a, b);
break; break;
case T_Func: case T_SubPlanExpr:
retval = _equalFunc(a, b); retval = _equalSubPlanExpr(a, b);
break; break;
case T_FieldSelect: case T_FieldSelect:
retval = _equalFieldSelect(a, b); retval = _equalFieldSelect(a, b);
break; break;
case T_ArrayRef:
retval = _equalArrayRef(a, b);
break;
case T_RelabelType: case T_RelabelType:
retval = _equalRelabelType(a, b); retval = _equalRelabelType(a, b);
break; break;
case T_CaseExpr:
retval = _equalCaseExpr(a, b);
break;
case T_CaseWhen:
retval = _equalCaseWhen(a, b);
break;
case T_NullTest:
retval = _equalNullTest(a, b);
break;
case T_BooleanTest:
retval = _equalBooleanTest(a, b);
break;
case T_ConstraintTest:
retval = _equalConstraintTest(a, b);
break;
case T_ConstraintTestValue:
retval = _equalConstraintTestValue(a, b);
break;
case T_TargetEntry:
retval = _equalTargetEntry(a, b);
break;
case T_RangeTblRef: case T_RangeTblRef:
retval = _equalRangeTblRef(a, b); retval = _equalRangeTblRef(a, b);
break; break;
...@@ -1572,6 +1607,9 @@ equal(void *a, void *b) ...@@ -1572,6 +1607,9 @@ equal(void *a, void *b)
retval = _equalJoinExpr(a, b); retval = _equalJoinExpr(a, b);
break; break;
/*
* RELATION NODES
*/
case T_PathKeyItem: case T_PathKeyItem:
retval = _equalPathKeyItem(a, b); retval = _equalPathKeyItem(a, b);
break; break;
...@@ -1582,6 +1620,9 @@ equal(void *a, void *b) ...@@ -1582,6 +1620,9 @@ equal(void *a, void *b)
retval = _equalJoinInfo(a, b); retval = _equalJoinInfo(a, b);
break; break;
/*
* LIST NODES
*/
case T_List: case T_List:
{ {
List *la = (List *) a; List *la = (List *) a;
...@@ -1612,6 +1653,9 @@ equal(void *a, void *b) ...@@ -1612,6 +1653,9 @@ equal(void *a, void *b)
retval = _equalValue(a, b); retval = _equalValue(a, b);
break; break;
/*
* PARSE NODES
*/
case T_Query: case T_Query:
retval = _equalQuery(a, b); retval = _equalQuery(a, b);
break; break;
...@@ -1844,12 +1888,6 @@ equal(void *a, void *b) ...@@ -1844,12 +1888,6 @@ equal(void *a, void *b)
case T_SortGroupBy: case T_SortGroupBy:
retval = _equalSortGroupBy(a, b); retval = _equalSortGroupBy(a, b);
break; break;
case T_Alias:
retval = _equalAlias(a, b);
break;
case T_RangeVar:
retval = _equalRangeVar(a, b);
break;
case T_RangeSubselect: case T_RangeSubselect:
retval = _equalRangeSubselect(a, b); retval = _equalRangeSubselect(a, b);
break; break;
...@@ -1871,9 +1909,6 @@ equal(void *a, void *b) ...@@ -1871,9 +1909,6 @@ equal(void *a, void *b)
case T_DefElem: case T_DefElem:
retval = _equalDefElem(a, b); retval = _equalDefElem(a, b);
break; break;
case T_TargetEntry:
retval = _equalTargetEntry(a, b);
break;
case T_RangeTblEntry: case T_RangeTblEntry:
retval = _equalRangeTblEntry(a, b); retval = _equalRangeTblEntry(a, b);
break; break;
...@@ -1884,24 +1919,6 @@ equal(void *a, void *b) ...@@ -1884,24 +1919,6 @@ equal(void *a, void *b)
/* GroupClause is equivalent to SortClause */ /* GroupClause is equivalent to SortClause */
retval = _equalSortClause(a, b); retval = _equalSortClause(a, b);
break; break;
case T_CaseExpr:
retval = _equalCaseExpr(a, b);
break;
case T_CaseWhen:
retval = _equalCaseWhen(a, b);
break;
case T_NullTest:
retval = _equalNullTest(a, b);
break;
case T_BooleanTest:
retval = _equalBooleanTest(a, b);
break;
case T_ConstraintTest:
retval = _equalConstraintTest(a, b);
break;
case T_ConstraintTestValue:
retval = _equalConstraintTestValue(a, b);
break;
case T_FkConstraint: case T_FkConstraint:
retval = _equalFkConstraint(a, b); retval = _equalFkConstraint(a, b);
break; break;
......
/* /*-------------------------------------------------------------------------
*
* makefuncs.c * makefuncs.c
* creator functions for primitive nodes. The functions here are for * creator functions for primitive nodes. The functions here are for
* the most frequently created nodes. * the most frequently created nodes.
...@@ -8,7 +9,9 @@ ...@@ -8,7 +9,9 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.36 2002/11/25 21:29:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.37 2002/12/12 15:49:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/ */
#include "postgres.h" #include "postgres.h"
...@@ -49,30 +52,9 @@ makeSimpleA_Expr(int oper, const char *name, ...@@ -49,30 +52,9 @@ makeSimpleA_Expr(int oper, const char *name,
return a; return a;
} }
/*
* makeOper -
* creates an Oper node
*/
Oper *
makeOper(Oid opno,
Oid opid,
Oid opresulttype,
bool opretset)
{
Oper *oper = makeNode(Oper);
oper->opno = opno;
oper->opid = opid;
oper->opresulttype = opresulttype;
oper->opretset = opretset;
oper->op_fcache = NULL;
return oper;
}
/* /*
* makeVar - * makeVar -
* creates a Var node * creates a Var node
*
*/ */
Var * Var *
makeVar(Index varno, makeVar(Index varno,
...@@ -104,10 +86,10 @@ makeVar(Index varno, ...@@ -104,10 +86,10 @@ makeVar(Index varno,
/* /*
* makeTargetEntry - * makeTargetEntry -
* creates a TargetEntry node(contains a Resdom) * creates a TargetEntry node (contains a Resdom)
*/ */
TargetEntry * TargetEntry *
makeTargetEntry(Resdom *resdom, Node *expr) makeTargetEntry(Resdom *resdom, Expr *expr)
{ {
TargetEntry *rt = makeNode(TargetEntry); TargetEntry *rt = makeNode(TargetEntry);
...@@ -188,6 +170,21 @@ makeNullConst(Oid consttype) ...@@ -188,6 +170,21 @@ makeNullConst(Oid consttype)
typByVal); typByVal);
} }
/*
* makeBoolExpr -
* creates a BoolExpr node
*/
Expr *
makeBoolExpr(BoolExprType boolop, List *args)
{
BoolExpr *b = makeNode(BoolExpr);
b->boolop = boolop;
b->args = args;
return (Expr *) b;
}
/* /*
* makeAlias - * makeAlias -
* creates an Alias node * creates an Alias node
...@@ -210,7 +207,7 @@ makeAlias(const char *aliasname, List *colnames) ...@@ -210,7 +207,7 @@ makeAlias(const char *aliasname, List *colnames)
* creates a RelabelType node * creates a RelabelType node
*/ */
RelabelType * RelabelType *
makeRelabelType(Node *arg, Oid rtype, int32 rtypmod, CoercionForm rformat) makeRelabelType(Expr *arg, Oid rtype, int32 rtypmod, CoercionForm rformat)
{ {
RelabelType *r = makeNode(RelabelType); RelabelType *r = makeNode(RelabelType);
......
...@@ -8,12 +8,10 @@ ...@@ -8,12 +8,10 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/nodeFuncs.c,v 1.19 2002/09/02 02:47:02 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/nodeFuncs.c,v 1.20 2002/12/12 15:49:28 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#include "postgres.h" #include "postgres.h"
#include "nodes/nodeFuncs.h" #include "nodes/nodeFuncs.h"
...@@ -21,6 +19,7 @@ ...@@ -21,6 +19,7 @@
static bool var_is_inner(Var *var); static bool var_is_inner(Var *var);
/* /*
* single_node - * single_node -
* Returns t if node corresponds to a single-noded expression * Returns t if node corresponds to a single-noded expression
...@@ -79,41 +78,15 @@ var_is_rel(Var *var) ...@@ -79,41 +78,15 @@ var_is_rel(Var *var)
*****************************************************************************/ *****************************************************************************/
/* /*
* replace_opid - * set_opfuncid -
*
* Given a oper node, resets the opfid field with the
* procedure OID (regproc id).
*
* Returns the modified oper node.
* *
* Set the opfuncid (procedure OID) in an OpExpr node,
* if it hasn't been set already.
*/ */
Oper * void
replace_opid(Oper *oper) set_opfuncid(OpExpr *opexpr)
{ {
oper->opid = get_opcode(oper->opno); if (opexpr->opfuncid == InvalidOid)
oper->op_fcache = NULL; opexpr->opfuncid = get_opcode(opexpr->opno);
return oper; opexpr->op_fcache = NULL; /* XXX will go away soon */
} }
/*****************************************************************************
* constant (CONST, PARAM) nodes
*****************************************************************************/
#ifdef NOT_USED
/*
* 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)
return true;
else
return false;
}
#endif
此差异已折叠。
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.57 2002/09/04 20:31:20 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.58 2002/12/12 15:49:28 tgl Exp $
* *
* HISTORY * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
...@@ -371,7 +371,7 @@ print_expr(Node *expr, List *rtable) ...@@ -371,7 +371,7 @@ print_expr(Node *expr, List *rtable)
char *opname; char *opname;
print_expr((Node *) get_leftop(e), rtable); print_expr((Node *) get_leftop(e), rtable);
opname = get_opname(((Oper *) e->oper)->opno); opname = get_opname(((OpExpr *) e)->opno);
printf(" %s ", ((opname != NULL) ? opname : "(invalid operator)")); printf(" %s ", ((opname != NULL) ? opname : "(invalid operator)"));
print_expr((Node *) get_rightop(e), rtable); print_expr((Node *) get_rightop(e), rtable);
} }
...@@ -432,7 +432,7 @@ print_tl(List *tlist, List *rtable) ...@@ -432,7 +432,7 @@ print_tl(List *tlist, List *rtable)
printf("(%d):\t", tle->resdom->reskey); printf("(%d):\t", tle->resdom->reskey);
else else
printf(" :\t"); printf(" :\t");
print_expr(tle->expr, rtable); print_expr((Node *) tle->expr, rtable);
printf("\n"); printf("\n");
} }
printf(")\n"); printf(")\n");
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.140 2002/11/25 21:29:38 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.141 2002/12/12 15:49:28 tgl Exp $
* *
* NOTES * NOTES
* Path and Plan nodes do not have any readfuncs support, because we * Path and Plan nodes do not have any readfuncs support, because we
...@@ -302,38 +302,30 @@ _readResdom(void) ...@@ -302,38 +302,30 @@ _readResdom(void)
READ_DONE(); READ_DONE();
} }
/* static Alias *
* _readExpr _readAlias(void)
*/
static Expr *
_readExpr(void)
{ {
READ_LOCALS(Expr); READ_LOCALS(Alias);
READ_OID_FIELD(typeOid); READ_STRING_FIELD(aliasname);
READ_NODE_FIELD(colnames);
/* do-it-yourself enum representation */ READ_DONE();
token = pg_strtok(&length); /* skip :opType */ }
token = pg_strtok(&length); /* get field value */
if (strncmp(token, "op", 2) == 0)
local_node->opType = OP_EXPR;
else if (strncmp(token, "distinct", 8) == 0)
local_node->opType = DISTINCT_EXPR;
else if (strncmp(token, "func", 4) == 0)
local_node->opType = FUNC_EXPR;
else if (strncmp(token, "or", 2) == 0)
local_node->opType = OR_EXPR;
else if (strncmp(token, "and", 3) == 0)
local_node->opType = AND_EXPR;
else if (strncmp(token, "not", 3) == 0)
local_node->opType = NOT_EXPR;
else if (strncmp(token, "subp", 4) == 0)
local_node->opType = SUBPLAN_EXPR;
else
elog(ERROR, "_readExpr: unknown opType \"%.*s\"", length, token);
READ_NODE_FIELD(oper); static RangeVar *
READ_NODE_FIELD(args); _readRangeVar(void)
{
READ_LOCALS(RangeVar);
local_node->catalogname = NULL; /* not currently saved in output
* format */
READ_STRING_FIELD(schemaname);
READ_STRING_FIELD(relname);
READ_ENUM_FIELD(inhOpt, InhOption);
READ_BOOL_FIELD(istemp);
READ_NODE_FIELD(alias);
READ_DONE(); READ_DONE();
} }
...@@ -357,27 +349,6 @@ _readVar(void) ...@@ -357,27 +349,6 @@ _readVar(void)
READ_DONE(); READ_DONE();
} }
/*
* _readArrayRef
*/
static ArrayRef *
_readArrayRef(void)
{
READ_LOCALS(ArrayRef);
READ_OID_FIELD(refrestype);
READ_INT_FIELD(refattrlength);
READ_INT_FIELD(refelemlength);
READ_BOOL_FIELD(refelembyval);
READ_CHAR_FIELD(refelemalign);
READ_NODE_FIELD(refupperindexpr);
READ_NODE_FIELD(reflowerindexpr);
READ_NODE_FIELD(refexpr);
READ_NODE_FIELD(refassgnexpr);
READ_DONE();
}
/* /*
* _readConst * _readConst
*/ */
...@@ -401,17 +372,72 @@ _readConst(void) ...@@ -401,17 +372,72 @@ _readConst(void)
} }
/* /*
* _readFunc * _readParam
*/
static Param *
_readParam(void)
{
READ_LOCALS(Param);
READ_INT_FIELD(paramkind);
READ_INT_FIELD(paramid);
READ_STRING_FIELD(paramname);
READ_OID_FIELD(paramtype);
READ_DONE();
}
/*
* _readAggref
*/
static Aggref *
_readAggref(void)
{
READ_LOCALS(Aggref);
READ_OID_FIELD(aggfnoid);
READ_OID_FIELD(aggtype);
READ_NODE_FIELD(target);
READ_BOOL_FIELD(aggstar);
READ_BOOL_FIELD(aggdistinct);
READ_DONE();
}
/*
* _readArrayRef
*/ */
static Func * static ArrayRef *
_readFunc(void) _readArrayRef(void)
{ {
READ_LOCALS(Func); READ_LOCALS(ArrayRef);
READ_OID_FIELD(refrestype);
READ_INT_FIELD(refattrlength);
READ_INT_FIELD(refelemlength);
READ_BOOL_FIELD(refelembyval);
READ_CHAR_FIELD(refelemalign);
READ_NODE_FIELD(refupperindexpr);
READ_NODE_FIELD(reflowerindexpr);
READ_NODE_FIELD(refexpr);
READ_NODE_FIELD(refassgnexpr);
READ_DONE();
}
/*
* _readFuncExpr
*/
static FuncExpr *
_readFuncExpr(void)
{
READ_LOCALS(FuncExpr);
READ_OID_FIELD(funcid); READ_OID_FIELD(funcid);
READ_OID_FIELD(funcresulttype); READ_OID_FIELD(funcresulttype);
READ_BOOL_FIELD(funcretset); READ_BOOL_FIELD(funcretset);
READ_ENUM_FIELD(funcformat, CoercionForm); READ_ENUM_FIELD(funcformat, CoercionForm);
READ_NODE_FIELD(args);
local_node->func_fcache = NULL; local_node->func_fcache = NULL;
...@@ -419,17 +445,28 @@ _readFunc(void) ...@@ -419,17 +445,28 @@ _readFunc(void)
} }
/* /*
* _readOper * _readOpExpr
*/ */
static Oper * static OpExpr *
_readOper(void) _readOpExpr(void)
{ {
READ_LOCALS(Oper); READ_LOCALS(OpExpr);
READ_OID_FIELD(opno); READ_OID_FIELD(opno);
READ_OID_FIELD(opid); READ_OID_FIELD(opfuncid);
/*
* The opfuncid is stored in the textual format primarily for debugging
* and documentation reasons. We want to always read it as zero to force
* it to be re-looked-up in the pg_operator entry. This ensures that
* stored rules don't have hidden dependencies on operators' functions.
* (We don't currently support an ALTER OPERATOR command, but might
* someday.)
*/
local_node->opfuncid = InvalidOid;
READ_OID_FIELD(opresulttype); READ_OID_FIELD(opresulttype);
READ_BOOL_FIELD(opretset); READ_BOOL_FIELD(opretset);
READ_NODE_FIELD(args);
local_node->op_fcache = NULL; local_node->op_fcache = NULL;
...@@ -437,52 +474,55 @@ _readOper(void) ...@@ -437,52 +474,55 @@ _readOper(void)
} }
/* /*
* _readParam * _readDistinctExpr
*/ */
static Param * static DistinctExpr *
_readParam(void) _readDistinctExpr(void)
{ {
READ_LOCALS(Param); READ_LOCALS(DistinctExpr);
READ_INT_FIELD(paramkind);
READ_INT_FIELD(paramid);
READ_STRING_FIELD(paramname);
READ_OID_FIELD(paramtype);
READ_DONE();
}
/* READ_OID_FIELD(opno);
* _readAggref READ_OID_FIELD(opfuncid);
/*
* The opfuncid is stored in the textual format primarily for debugging
* and documentation reasons. We want to always read it as zero to force
* it to be re-looked-up in the pg_operator entry. This ensures that
* stored rules don't have hidden dependencies on operators' functions.
* (We don't currently support an ALTER OPERATOR command, but might
* someday.)
*/ */
static Aggref * local_node->opfuncid = InvalidOid;
_readAggref(void)
{
READ_LOCALS(Aggref);
READ_OID_FIELD(aggfnoid); READ_OID_FIELD(opresulttype);
READ_OID_FIELD(aggtype); READ_BOOL_FIELD(opretset);
READ_NODE_FIELD(target); READ_NODE_FIELD(args);
READ_BOOL_FIELD(aggstar);
READ_BOOL_FIELD(aggdistinct); local_node->op_fcache = NULL;
/* aggno is not saved since it is just executor state */
READ_DONE(); READ_DONE();
} }
static RangeVar * /*
_readRangeVar(void) * _readBoolExpr
*/
static BoolExpr *
_readBoolExpr(void)
{ {
READ_LOCALS(RangeVar); READ_LOCALS(BoolExpr);
local_node->catalogname = NULL; /* not currently saved in output /* do-it-yourself enum representation */
* format */ token = pg_strtok(&length); /* skip :boolop */
token = pg_strtok(&length); /* get field value */
if (strncmp(token, "and", 3) == 0)
local_node->boolop = AND_EXPR;
else if (strncmp(token, "or", 2) == 0)
local_node->boolop = OR_EXPR;
else if (strncmp(token, "not", 3) == 0)
local_node->boolop = NOT_EXPR;
else
elog(ERROR, "_readBoolExpr: unknown boolop \"%.*s\"", length, token);
READ_STRING_FIELD(schemaname); READ_NODE_FIELD(args);
READ_STRING_FIELD(relname);
READ_ENUM_FIELD(inhOpt, InhOption);
READ_BOOL_FIELD(istemp);
READ_NODE_FIELD(alias);
READ_DONE(); READ_DONE();
} }
...@@ -504,6 +544,10 @@ _readSubLink(void) ...@@ -504,6 +544,10 @@ _readSubLink(void)
READ_DONE(); READ_DONE();
} }
/*
* _readSubPlanExpr is not needed since it doesn't appear in stored rules.
*/
/* /*
* _readFieldSelect * _readFieldSelect
*/ */
...@@ -536,58 +580,6 @@ _readRelabelType(void) ...@@ -536,58 +580,6 @@ _readRelabelType(void)
READ_DONE(); READ_DONE();
} }
/*
* _readRangeTblRef
*/
static RangeTblRef *
_readRangeTblRef(void)
{
READ_LOCALS(RangeTblRef);
READ_INT_FIELD(rtindex);
READ_DONE();
}
/*
* _readJoinExpr
*/
static JoinExpr *
_readJoinExpr(void)
{
READ_LOCALS(JoinExpr);
READ_ENUM_FIELD(jointype, JoinType);
READ_BOOL_FIELD(isNatural);
READ_NODE_FIELD(larg);
READ_NODE_FIELD(rarg);
READ_NODE_FIELD(using);
READ_NODE_FIELD(quals);
READ_NODE_FIELD(alias);
READ_INT_FIELD(rtindex);
READ_DONE();
}
/*
* _readFromExpr
*/
static FromExpr *
_readFromExpr(void)
{
READ_LOCALS(FromExpr);
READ_NODE_FIELD(fromlist);
READ_NODE_FIELD(quals);
READ_DONE();
}
/*
* Stuff from parsenodes.h.
*/
/* /*
* _readCaseExpr * _readCaseExpr
*/ */
...@@ -663,17 +655,6 @@ _readConstraintTest(void) ...@@ -663,17 +655,6 @@ _readConstraintTest(void)
READ_DONE(); READ_DONE();
} }
/*
* _readDomainConstraintValue
*/
static DomainConstraintValue *
_readDomainConstraintValue(void)
{
READ_LOCALS_NO_FIELDS(DomainConstraintValue);
READ_DONE();
}
/* /*
* _readConstraintTestValue * _readConstraintTestValue
*/ */
...@@ -697,12 +678,63 @@ _readTargetEntry(void) ...@@ -697,12 +678,63 @@ _readTargetEntry(void)
READ_LOCALS(TargetEntry); READ_LOCALS(TargetEntry);
READ_NODE_FIELD(resdom); READ_NODE_FIELD(resdom);
/* fjoin not supported ... */
READ_NODE_FIELD(expr); READ_NODE_FIELD(expr);
READ_DONE(); READ_DONE();
} }
/*
* _readRangeTblRef
*/
static RangeTblRef *
_readRangeTblRef(void)
{
READ_LOCALS(RangeTblRef);
READ_INT_FIELD(rtindex);
READ_DONE();
}
/*
* _readJoinExpr
*/
static JoinExpr *
_readJoinExpr(void)
{
READ_LOCALS(JoinExpr);
READ_ENUM_FIELD(jointype, JoinType);
READ_BOOL_FIELD(isNatural);
READ_NODE_FIELD(larg);
READ_NODE_FIELD(rarg);
READ_NODE_FIELD(using);
READ_NODE_FIELD(quals);
READ_NODE_FIELD(alias);
READ_INT_FIELD(rtindex);
READ_DONE();
}
/*
* _readFromExpr
*/
static FromExpr *
_readFromExpr(void)
{
READ_LOCALS(FromExpr);
READ_NODE_FIELD(fromlist);
READ_NODE_FIELD(quals);
READ_DONE();
}
/*
* Stuff from parsenodes.h.
*/
static ColumnRef * static ColumnRef *
_readColumnRef(void) _readColumnRef(void)
{ {
...@@ -760,13 +792,13 @@ _readExprFieldSelect(void) ...@@ -760,13 +792,13 @@ _readExprFieldSelect(void)
READ_DONE(); READ_DONE();
} }
static Alias * /*
_readAlias(void) * _readDomainConstraintValue
*/
static DomainConstraintValue *
_readDomainConstraintValue(void)
{ {
READ_LOCALS(Alias); READ_LOCALS_NO_FIELDS(DomainConstraintValue);
READ_STRING_FIELD(aliasname);
READ_NODE_FIELD(colnames);
READ_DONE(); READ_DONE();
} }
...@@ -835,53 +867,7 @@ parseNodeString(void) ...@@ -835,53 +867,7 @@ parseNodeString(void)
#define MATCH(tokname, namelen) \ #define MATCH(tokname, namelen) \
(length == namelen && strncmp(token, tokname, namelen) == 0) (length == namelen && strncmp(token, tokname, namelen) == 0)
if (MATCH("AGGREF", 6)) if (MATCH("QUERY", 5))
return_value = _readAggref();
else if (MATCH("SUBLINK", 7))
return_value = _readSubLink();
else if (MATCH("FIELDSELECT", 11))
return_value = _readFieldSelect();
else if (MATCH("RELABELTYPE", 11))
return_value = _readRelabelType();
else if (MATCH("RANGETBLREF", 11))
return_value = _readRangeTblRef();
else if (MATCH("FROMEXPR", 8))
return_value = _readFromExpr();
else if (MATCH("JOINEXPR", 8))
return_value = _readJoinExpr();
else if (MATCH("RESDOM", 6))
return_value = _readResdom();
else if (MATCH("EXPR", 4))
return_value = _readExpr();
else if (MATCH("ARRAYREF", 8))
return_value = _readArrayRef();
else if (MATCH("VAR", 3))
return_value = _readVar();
else if (MATCH("CONST", 5))
return_value = _readConst();
else if (MATCH("FUNC", 4))
return_value = _readFunc();
else if (MATCH("OPER", 4))
return_value = _readOper();
else if (MATCH("PARAM", 5))
return_value = _readParam();
else if (MATCH("TARGETENTRY", 11))
return_value = _readTargetEntry();
else if (MATCH("RANGEVAR", 8))
return_value = _readRangeVar();
else if (MATCH("COLUMNREF", 9))
return_value = _readColumnRef();
else if (MATCH("COLUMNDEF", 9))
return_value = _readColumnDef();
else if (MATCH("TYPENAME", 8))
return_value = _readTypeName();
else if (MATCH("EXPRFIELDSELECT", 15))
return_value = _readExprFieldSelect();
else if (MATCH("ALIAS", 5))
return_value = _readAlias();
else if (MATCH("RTE", 3))
return_value = _readRangeTblEntry();
else if (MATCH("QUERY", 5))
return_value = _readQuery(); return_value = _readQuery();
else if (MATCH("NOTIFY", 6)) else if (MATCH("NOTIFY", 6))
return_value = _readNotifyStmt(); return_value = _readNotifyStmt();
...@@ -891,6 +877,36 @@ parseNodeString(void) ...@@ -891,6 +877,36 @@ parseNodeString(void)
return_value = _readGroupClause(); return_value = _readGroupClause();
else if (MATCH("SETOPERATIONSTMT", 16)) else if (MATCH("SETOPERATIONSTMT", 16))
return_value = _readSetOperationStmt(); return_value = _readSetOperationStmt();
else if (MATCH("RESDOM", 6))
return_value = _readResdom();
else if (MATCH("ALIAS", 5))
return_value = _readAlias();
else if (MATCH("RANGEVAR", 8))
return_value = _readRangeVar();
else if (MATCH("VAR", 3))
return_value = _readVar();
else if (MATCH("CONST", 5))
return_value = _readConst();
else if (MATCH("PARAM", 5))
return_value = _readParam();
else if (MATCH("AGGREF", 6))
return_value = _readAggref();
else if (MATCH("ARRAYREF", 8))
return_value = _readArrayRef();
else if (MATCH("FUNCEXPR", 8))
return_value = _readFuncExpr();
else if (MATCH("OPEXPR", 6))
return_value = _readOpExpr();
else if (MATCH("DISTINCTEXPR", 12))
return_value = _readDistinctExpr();
else if (MATCH("BOOLEXPR", 8))
return_value = _readBoolExpr();
else if (MATCH("SUBLINK", 7))
return_value = _readSubLink();
else if (MATCH("FIELDSELECT", 11))
return_value = _readFieldSelect();
else if (MATCH("RELABELTYPE", 11))
return_value = _readRelabelType();
else if (MATCH("CASE", 4)) else if (MATCH("CASE", 4))
return_value = _readCaseExpr(); return_value = _readCaseExpr();
else if (MATCH("WHEN", 4)) else if (MATCH("WHEN", 4))
...@@ -901,10 +917,28 @@ parseNodeString(void) ...@@ -901,10 +917,28 @@ parseNodeString(void)
return_value = _readBooleanTest(); return_value = _readBooleanTest();
else if (MATCH("CONSTRAINTTEST", 14)) else if (MATCH("CONSTRAINTTEST", 14))
return_value = _readConstraintTest(); return_value = _readConstraintTest();
else if (MATCH("DOMAINCONSTRAINTVALUE", 21))
return_value = _readDomainConstraintValue();
else if (MATCH("CONSTRAINTTESTVALUE", 19)) else if (MATCH("CONSTRAINTTESTVALUE", 19))
return_value = _readConstraintTestValue(); return_value = _readConstraintTestValue();
else if (MATCH("TARGETENTRY", 11))
return_value = _readTargetEntry();
else if (MATCH("RANGETBLREF", 11))
return_value = _readRangeTblRef();
else if (MATCH("JOINEXPR", 8))
return_value = _readJoinExpr();
else if (MATCH("FROMEXPR", 8))
return_value = _readFromExpr();
else if (MATCH("COLUMNREF", 9))
return_value = _readColumnRef();
else if (MATCH("COLUMNDEF", 9))
return_value = _readColumnDef();
else if (MATCH("TYPENAME", 8))
return_value = _readTypeName();
else if (MATCH("EXPRFIELDSELECT", 15))
return_value = _readExprFieldSelect();
else if (MATCH("DOMAINCONSTRAINTVALUE", 21))
return_value = _readDomainConstraintValue();
else if (MATCH("RTE", 3))
return_value = _readRangeTblEntry();
else else
{ {
elog(ERROR, "badly formatted node string \"%.32s\"...", token); elog(ERROR, "badly formatted node string \"%.32s\"...", token);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.53 2002/11/25 21:29:39 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.54 2002/12/12 15:49:28 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -141,7 +141,7 @@ clauselist_selectivity(Query *root, ...@@ -141,7 +141,7 @@ clauselist_selectivity(Query *root,
if (is_opclause(clause) && if (is_opclause(clause) &&
(varRelid != 0 || NumRelids(clause) == 1)) (varRelid != 0 || NumRelids(clause) == 1))
{ {
Expr *expr = (Expr *) clause; OpExpr *expr = (OpExpr *) clause;
if (length(expr->args) == 2) if (length(expr->args) == 2)
{ {
...@@ -151,7 +151,7 @@ clauselist_selectivity(Query *root, ...@@ -151,7 +151,7 @@ clauselist_selectivity(Query *root,
(varonleft = false, (varonleft = false,
is_pseudo_constant_clause(lfirst(expr->args)))) is_pseudo_constant_clause(lfirst(expr->args))))
{ {
Oid opno = ((Oper *) expr->oper)->opno; Oid opno = expr->opno;
RegProcedure oprrest = get_oprrest(opno); RegProcedure oprrest = get_oprrest(opno);
s2 = restriction_selectivity(root, opno, s2 = restriction_selectivity(root, opno,
...@@ -430,7 +430,7 @@ clause_selectivity(Query *root, ...@@ -430,7 +430,7 @@ clause_selectivity(Query *root,
{ {
/* share code with clauselist_selectivity() */ /* share code with clauselist_selectivity() */
s1 = clauselist_selectivity(root, s1 = clauselist_selectivity(root,
((Expr *) clause)->args, ((BoolExpr *) clause)->args,
varRelid); varRelid);
} }
else if (or_clause(clause)) else if (or_clause(clause))
...@@ -443,7 +443,7 @@ clause_selectivity(Query *root, ...@@ -443,7 +443,7 @@ clause_selectivity(Query *root,
List *arg; List *arg;
s1 = 0.0; s1 = 0.0;
foreach(arg, ((Expr *) clause)->args) foreach(arg, ((BoolExpr *) clause)->args)
{ {
Selectivity s2 = clause_selectivity(root, Selectivity s2 = clause_selectivity(root,
(Node *) lfirst(arg), (Node *) lfirst(arg),
...@@ -454,7 +454,7 @@ clause_selectivity(Query *root, ...@@ -454,7 +454,7 @@ clause_selectivity(Query *root,
} }
else if (is_opclause(clause)) else if (is_opclause(clause))
{ {
Oid opno = ((Oper *) ((Expr *) clause)->oper)->opno; Oid opno = ((OpExpr *) clause)->opno;
bool is_join_clause; bool is_join_clause;
if (varRelid != 0) if (varRelid != 0)
...@@ -479,13 +479,14 @@ clause_selectivity(Query *root, ...@@ -479,13 +479,14 @@ clause_selectivity(Query *root,
{ {
/* Estimate selectivity for a join clause. */ /* Estimate selectivity for a join clause. */
s1 = join_selectivity(root, opno, s1 = join_selectivity(root, opno,
((Expr *) clause)->args); ((OpExpr *) clause)->args);
} }
else else
{ {
/* Estimate selectivity for a restriction clause. */ /* Estimate selectivity for a restriction clause. */
s1 = restriction_selectivity(root, opno, s1 = restriction_selectivity(root, opno,
((Expr *) clause)->args, varRelid); ((OpExpr *) clause)->args,
varRelid);
} }
} }
else if (is_funcclause(clause)) else if (is_funcclause(clause))
...@@ -509,7 +510,7 @@ clause_selectivity(Query *root, ...@@ -509,7 +510,7 @@ clause_selectivity(Query *root,
/* Use node specific selectivity calculation function */ /* Use node specific selectivity calculation function */
s1 = nulltestsel(root, s1 = nulltestsel(root,
((NullTest *) clause)->nulltesttype, ((NullTest *) clause)->nulltesttype,
((NullTest *) clause)->arg, (Node *) ((NullTest *) clause)->arg,
varRelid); varRelid);
} }
else if (IsA(clause, BooleanTest)) else if (IsA(clause, BooleanTest))
...@@ -517,14 +518,14 @@ clause_selectivity(Query *root, ...@@ -517,14 +518,14 @@ clause_selectivity(Query *root,
/* Use node specific selectivity calculation function */ /* Use node specific selectivity calculation function */
s1 = booltestsel(root, s1 = booltestsel(root,
((BooleanTest *) clause)->booltesttype, ((BooleanTest *) clause)->booltesttype,
((BooleanTest *) clause)->arg, (Node *) ((BooleanTest *) clause)->arg,
varRelid); varRelid);
} }
else if (IsA(clause, RelabelType)) else if (IsA(clause, RelabelType))
{ {
/* Not sure this case is needed, but it can't hurt */ /* Not sure this case is needed, but it can't hurt */
s1 = clause_selectivity(root, s1 = clause_selectivity(root,
((RelabelType *) clause)->arg, (Node *) ((RelabelType *) clause)->arg,
varRelid); varRelid);
} }
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.93 2002/11/30 05:21:02 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.94 2002/12/12 15:49:28 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1220,23 +1220,12 @@ cost_qual_eval_walker(Node *node, Cost *total) ...@@ -1220,23 +1220,12 @@ cost_qual_eval_walker(Node *node, Cost *total)
* Should we try to account for the possibility of short-circuit * Should we try to account for the possibility of short-circuit
* evaluation of AND/OR? * evaluation of AND/OR?
*/ */
if (IsA(node, Expr)) if (IsA(node, FuncExpr) ||
{ IsA(node, OpExpr) ||
Expr *expr = (Expr *) node; IsA(node, DistinctExpr))
switch (expr->opType)
{
case OP_EXPR:
case DISTINCT_EXPR:
case FUNC_EXPR:
*total += cpu_operator_cost; *total += cpu_operator_cost;
break; else if (IsA(node, SubPlanExpr))
case OR_EXPR: {
case AND_EXPR:
case NOT_EXPR:
break;
case SUBPLAN_EXPR:
/* /*
* A subplan node in an expression indicates that the * A subplan node in an expression indicates that the
* subplan will be executed on each evaluation, so charge * subplan will be executed on each evaluation, so charge
...@@ -1247,8 +1236,7 @@ cost_qual_eval_walker(Node *node, Cost *total) ...@@ -1247,8 +1236,7 @@ cost_qual_eval_walker(Node *node, Cost *total)
* NOTE: this logic should agree with the estimates used by * NOTE: this logic should agree with the estimates used by
* make_subplan() in plan/subselect.c. * make_subplan() in plan/subselect.c.
*/ */
{ SubPlanExpr *subplan = (SubPlanExpr *) node;
SubPlan *subplan = (SubPlan *) expr->oper;
Plan *plan = subplan->plan; Plan *plan = subplan->plan;
Cost subcost; Cost subcost;
...@@ -1273,10 +1261,7 @@ cost_qual_eval_walker(Node *node, Cost *total) ...@@ -1273,10 +1261,7 @@ cost_qual_eval_walker(Node *node, Cost *total)
} }
*total += subcost; *total += subcost;
} }
break;
}
/* fall through to examine args of Expr node */
}
return expression_tree_walker(node, cost_qual_eval_walker, return expression_tree_walker(node, cost_qual_eval_walker,
(void *) total); (void *) total);
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.48 2002/11/24 21:52:14 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.49 2002/12/12 15:49:31 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -96,7 +96,7 @@ create_or_index_paths(Query *root, RelOptInfo *rel) ...@@ -96,7 +96,7 @@ create_or_index_paths(Query *root, RelOptInfo *rel)
best_or_subclause_indices(root, best_or_subclause_indices(root,
rel, rel,
restrictinfo->clause->args, ((BoolExpr *) restrictinfo->clause)->args,
restrictinfo->subclauseindices, restrictinfo->subclauseindices,
pathnode); pathnode);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.58 2002/11/25 21:29:40 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.59 2002/12/12 15:49:32 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -96,7 +96,7 @@ preprocess_targetlist(List *tlist, ...@@ -96,7 +96,7 @@ preprocess_targetlist(List *tlist,
if (command_type == CMD_DELETE) if (command_type == CMD_DELETE)
tlist = listCopy(tlist); tlist = listCopy(tlist);
tlist = lappend(tlist, makeTargetEntry(resdom, (Node *) var)); tlist = lappend(tlist, makeTargetEntry(resdom, (Expr *) var));
} }
return tlist; return tlist;
...@@ -215,7 +215,7 @@ expand_targetlist(List *tlist, int command_type, ...@@ -215,7 +215,7 @@ expand_targetlist(List *tlist, int command_type,
atttypmod, atttypmod,
pstrdup(NameStr(att_tup->attname)), pstrdup(NameStr(att_tup->attname)),
false), false),
new_expr); (Expr *) new_expr);
} }
new_tlist = lappend(new_tlist, new_tle); new_tlist = lappend(new_tlist, new_tle);
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册