mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Get rid of hashkeys field of Hash plan node, since it's redundant with
the hashclauses field of the parent HashJoin. This avoids problems with duplicated links to SubPlans in hash clauses, as per report from Andrew Holm-Hansen.
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.159 2003/11/12 21:15:53 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.160 2003/11/25 21:00:53 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -97,7 +97,7 @@ static HashJoin *make_hashjoin(List *tlist,
|
||||
List *hashclauses,
|
||||
Plan *lefttree, Plan *righttree,
|
||||
JoinType jointype);
|
||||
static Hash *make_hash(List *tlist, List *hashkeys, Plan *lefttree);
|
||||
static Hash *make_hash(List *tlist, Plan *lefttree);
|
||||
static MergeJoin *make_mergejoin(List *tlist,
|
||||
List *joinclauses, List *otherclauses,
|
||||
List *mergeclauses,
|
||||
@ -1067,8 +1067,6 @@ create_hashjoin_plan(Query *root,
|
||||
List *hashclauses;
|
||||
HashJoin *join_plan;
|
||||
Hash *hash_plan;
|
||||
List *innerhashkeys;
|
||||
List *hcl;
|
||||
|
||||
/* Get the join qual clauses (in plain expression form) */
|
||||
if (IS_OUTER_JOIN(best_path->jpath.jointype))
|
||||
@ -1102,14 +1100,6 @@ create_hashjoin_plan(Query *root,
|
||||
otherclauses = order_qual_clauses(root, otherclauses);
|
||||
hashclauses = order_qual_clauses(root, hashclauses);
|
||||
|
||||
/*
|
||||
* Extract the inner hash keys (right-hand operands of the
|
||||
* hashclauses) to put in the Hash node.
|
||||
*/
|
||||
innerhashkeys = NIL;
|
||||
foreach(hcl, hashclauses)
|
||||
innerhashkeys = lappend(innerhashkeys, get_rightop(lfirst(hcl)));
|
||||
|
||||
/* We don't want any excess columns in the hashed tuples */
|
||||
disuse_physical_tlist(inner_plan, best_path->jpath.innerjoinpath);
|
||||
|
||||
@ -1117,7 +1107,6 @@ create_hashjoin_plan(Query *root,
|
||||
* Build the hash node and hash join node.
|
||||
*/
|
||||
hash_plan = make_hash(inner_plan->targetlist,
|
||||
innerhashkeys,
|
||||
inner_plan);
|
||||
join_plan = make_hashjoin(tlist,
|
||||
joinclauses,
|
||||
@ -1728,7 +1717,7 @@ make_hashjoin(List *tlist,
|
||||
}
|
||||
|
||||
static Hash *
|
||||
make_hash(List *tlist, List *hashkeys, Plan *lefttree)
|
||||
make_hash(List *tlist, Plan *lefttree)
|
||||
{
|
||||
Hash *node = makeNode(Hash);
|
||||
Plan *plan = &node->plan;
|
||||
@ -1744,7 +1733,6 @@ make_hash(List *tlist, List *hashkeys, Plan *lefttree)
|
||||
plan->qual = NIL;
|
||||
plan->lefttree = lefttree;
|
||||
plan->righttree = NULL;
|
||||
node->hashkeys = hashkeys;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.97 2003/08/08 21:41:50 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.98 2003/11/25 21:00:54 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -167,24 +167,6 @@ set_plan_references(Plan *plan, List *rtable)
|
||||
(Node *) ((HashJoin *) plan)->hashclauses);
|
||||
break;
|
||||
case T_Hash:
|
||||
|
||||
/*
|
||||
* Hash does not evaluate its targetlist or quals, so don't
|
||||
* touch those (see comments below). But we do need to fix
|
||||
* its hashkeys. The hashkeys are a little bizarre because
|
||||
* they need to match the hashclauses of the parent HashJoin
|
||||
* node, so we use join_references to fix them.
|
||||
*/
|
||||
((Hash *) plan)->hashkeys =
|
||||
join_references(((Hash *) plan)->hashkeys,
|
||||
rtable,
|
||||
NIL,
|
||||
plan->lefttree->targetlist,
|
||||
(Index) 0,
|
||||
targetlist_has_non_vars(plan->lefttree->targetlist));
|
||||
fix_expr_references(plan,
|
||||
(Node *) ((Hash *) plan)->hashkeys);
|
||||
break;
|
||||
case T_Material:
|
||||
case T_Sort:
|
||||
case T_Unique:
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.83 2003/10/18 16:52:15 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.84 2003/11/25 21:00:54 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1013,10 +1013,6 @@ finalize_plan(Plan *plan, List *rtable,
|
||||
break;
|
||||
|
||||
case T_Hash:
|
||||
finalize_primnode((Node *) ((Hash *) plan)->hashkeys,
|
||||
&context);
|
||||
break;
|
||||
|
||||
case T_Agg:
|
||||
case T_SeqScan:
|
||||
case T_Material:
|
||||
|
Reference in New Issue
Block a user