mirror of
https://github.com/postgres/postgres.git
synced 2025-05-23 00:02:38 -04:00
Fix Query handling for inheritance, and cost computations.
This commit is contained in:
parent
d451a3b3bc
commit
c64cc3228a
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.16 1997/11/25 21:59:40 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.17 1997/12/18 03:03:31 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -516,7 +516,7 @@ _copyAgg(Agg *from)
|
||||
CopyTempFields((Temp *) from, (Temp *) newnode);
|
||||
|
||||
newnode->numAgg = from->numAgg;
|
||||
newnode->aggs = malloc(sizeof(Aggreg *));
|
||||
newnode->aggs = palloc(sizeof(Aggreg *));
|
||||
for (i = 0; i < from->numAgg; i++)
|
||||
{
|
||||
newnode->aggs[i] = copyObject(from->aggs[i]);
|
||||
@ -1519,7 +1519,7 @@ static Query *
|
||||
_copyQuery(Query *from)
|
||||
{
|
||||
Query *newnode = makeNode(Query);
|
||||
|
||||
|
||||
newnode->commandType = from->commandType;
|
||||
newnode->resultRelation = from->resultRelation;
|
||||
/* probably should dup this string instead of just pointing */
|
||||
@ -1555,6 +1555,11 @@ _copyQuery(Query *from)
|
||||
Node_Copy(from, newnode, targetList);
|
||||
Node_Copy(from, newnode, qual);
|
||||
|
||||
Node_Copy(from, newnode, groupClause);
|
||||
Node_Copy(from, newnode, havingQual); /* currently ignored */
|
||||
|
||||
Node_Copy(from, newnode, Aggreg);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.16 1997/11/25 21:59:56 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.17 1997/12/18 03:03:35 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -943,7 +943,7 @@ make_seqscan(List *qptlist,
|
||||
SeqScan *node = makeNode(SeqScan);
|
||||
Plan *plan = &node->plan;
|
||||
|
||||
plan->cost = 0.0;
|
||||
plan->cost = (lefttree ? lefttree->cost : 0);
|
||||
plan->state = (EState *) NULL;
|
||||
plan->targetlist = qptlist;
|
||||
plan->qual = qpqual;
|
||||
@ -989,7 +989,8 @@ make_nestloop(List *qptlist,
|
||||
NestLoop *node = makeNode(NestLoop);
|
||||
Plan *plan = &node->join;
|
||||
|
||||
plan->cost = 0.0;
|
||||
plan->cost = (lefttree ? lefttree->cost : 0) +
|
||||
(righttree ? righttree->cost : 0);
|
||||
plan->state = (EState *) NULL;
|
||||
plan->targetlist = qptlist;
|
||||
plan->qual = qpqual;
|
||||
@ -1010,6 +1011,8 @@ make_hashjoin(List *tlist,
|
||||
HashJoin *node = makeNode(HashJoin);
|
||||
Plan *plan = &node->join;
|
||||
|
||||
plan->cost = (lefttree ? lefttree->cost : 0) +
|
||||
(righttree ? righttree->cost : 0);
|
||||
plan->cost = 0.0;
|
||||
plan->state = (EState *) NULL;
|
||||
plan->targetlist = tlist;
|
||||
@ -1031,6 +1034,7 @@ make_hash(List *tlist, Var *hashkey, Plan *lefttree)
|
||||
Hash *node = makeNode(Hash);
|
||||
Plan *plan = &node->plan;
|
||||
|
||||
plan->cost = (lefttree ? lefttree->cost : 0);
|
||||
plan->cost = 0.0;
|
||||
plan->state = (EState *) NULL;
|
||||
plan->targetlist = tlist;
|
||||
@ -1058,7 +1062,8 @@ make_mergesort(List *tlist,
|
||||
MergeJoin *node = makeNode(MergeJoin);
|
||||
Plan *plan = &node->join;
|
||||
|
||||
plan->cost = 0.0;
|
||||
plan->cost = (lefttree ? lefttree->cost : 0) +
|
||||
(righttree ? righttree->cost : 0);
|
||||
plan->state = (EState *) NULL;
|
||||
plan->targetlist = tlist;
|
||||
plan->qual = qpqual;
|
||||
@ -1078,7 +1083,7 @@ make_sort(List *tlist, Oid tempid, Plan *lefttree, int keycount)
|
||||
Sort *node = makeNode(Sort);
|
||||
Plan *plan = &node->plan;
|
||||
|
||||
plan->cost = 0.0;
|
||||
plan->cost = (lefttree ? lefttree->cost : 0);
|
||||
plan->state = (EState *) NULL;
|
||||
plan->targetlist = tlist;
|
||||
plan->qual = NIL;
|
||||
@ -1099,7 +1104,7 @@ make_material(List *tlist,
|
||||
Material *node = makeNode(Material);
|
||||
Plan *plan = &node->plan;
|
||||
|
||||
plan->cost = 0.0;
|
||||
plan->cost = (lefttree ? lefttree->cost : 0);
|
||||
plan->state = (EState *) NULL;
|
||||
plan->targetlist = tlist;
|
||||
plan->qual = NIL;
|
||||
@ -1137,7 +1142,7 @@ make_group(List *tlist,
|
||||
{
|
||||
Group *node = makeNode(Group);
|
||||
|
||||
node->plan.cost = 0.0;
|
||||
node->plan.cost = (lefttree ? lefttree->plan.cost : 0);
|
||||
node->plan.state = (EState *) NULL;
|
||||
node->plan.qual = NULL;
|
||||
node->plan.targetlist = tlist;
|
||||
@ -1164,7 +1169,7 @@ make_unique(List *tlist, Plan *lefttree, char *uniqueAttr)
|
||||
Unique *node = makeNode(Unique);
|
||||
Plan *plan = &node->plan;
|
||||
|
||||
plan->cost = 0.0;
|
||||
plan->cost = (lefttree ? lefttree->cost : 0);
|
||||
plan->state = (EState *) NULL;
|
||||
plan->targetlist = tlist;
|
||||
plan->qual = NIL;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.8 1997/09/25 12:21:15 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.9 1997/12/18 03:03:38 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -362,7 +362,7 @@ make_result(List *tlist,
|
||||
Plan *plan = &node->plan;
|
||||
|
||||
tlist = generate_fjoin(tlist);
|
||||
plan->cost = 0.0;
|
||||
plan->cost = (subplan ? subplan->cost : 0);
|
||||
plan->state = (EState *) NULL;
|
||||
plan->targetlist = tlist;
|
||||
plan->lefttree = subplan;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.9 1997/11/25 22:00:10 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.10 1997/12/18 03:03:41 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -241,6 +241,9 @@ plan_union_query(List *relids,
|
||||
/* new_root->uniqueFlag = false; */
|
||||
new_root->uniqueFlag = NULL;
|
||||
new_root->sortClause = NULL;
|
||||
new_root->groupClause = NULL;
|
||||
new_root->qry_numAgg = 0;
|
||||
new_root->qry_aggs = NULL;
|
||||
fix_parsetree_attnums(rt_index,
|
||||
rt_entry->relid,
|
||||
relid,
|
||||
|
Loading…
x
Reference in New Issue
Block a user