mirror of
https://github.com/postgres/postgres.git
synced 2025-05-20 05:13:53 +03:00
Band-aid solution for problems with SubPlans used in hash join clauses,
per report from Andrew Holm-Hansen. The difficulty arises from the fact that the planner allowed a Hash node's hashkeys to share substructure with the parent HashJoin node's hashclauses, plus some rather bizarre choices about who initializes what during executor startup. A cleaner but more invasive solution is to not store hashkeys separately in the plan tree at all, but let the HashJoin node deconstruct hashclauses during executor startup. I plan to fix it that way in HEAD.
This commit is contained in:
parent
bcdf28eb02
commit
9765c6a9a3
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.57 2003/09/25 06:57:59 petere Exp $
|
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.57.2.1 2003/11/25 19:17:16 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -417,7 +417,7 @@ ExecInitHashJoin(HashJoin *node, EState *estate)
|
|||||||
*/
|
*/
|
||||||
hjstate->hj_InnerHashKeys = (List *)
|
hjstate->hj_InnerHashKeys = (List *)
|
||||||
ExecInitExpr((Expr *) hashNode->hashkeys,
|
ExecInitExpr((Expr *) hashNode->hashkeys,
|
||||||
innerPlanState(hjstate));
|
(PlanState *) hjstate);
|
||||||
((HashState *) innerPlanState(hjstate))->hashkeys =
|
((HashState *) innerPlanState(hjstate))->hashkeys =
|
||||||
hjstate->hj_InnerHashKeys;
|
hjstate->hj_InnerHashKeys;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.157 2003/08/27 12:44:12 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.157.2.1 2003/11/25 19:17:16 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1093,12 +1093,14 @@ create_hashjoin_plan(Query *root,
|
|||||||
hashclauses = order_qual_clauses(root, hashclauses);
|
hashclauses = order_qual_clauses(root, hashclauses);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Extract the inner hash keys (right-hand operands of the
|
* Extract the inner hash keys (right-hand operands of the hashclauses)
|
||||||
* hashclauses) to put in the Hash node.
|
* to put in the Hash node. Must do a deep copy in case there are
|
||||||
|
* subplans in the hash keys.
|
||||||
*/
|
*/
|
||||||
innerhashkeys = NIL;
|
innerhashkeys = NIL;
|
||||||
foreach(hcl, hashclauses)
|
foreach(hcl, hashclauses)
|
||||||
innerhashkeys = lappend(innerhashkeys, get_rightop(lfirst(hcl)));
|
innerhashkeys = lappend(innerhashkeys,
|
||||||
|
copyObject(get_rightop(lfirst(hcl))));
|
||||||
|
|
||||||
/* We don't want any excess columns in the hashed tuples */
|
/* We don't want any excess columns in the hashed tuples */
|
||||||
disuse_physical_tlist(inner_plan, best_path->jpath.innerjoinpath);
|
disuse_physical_tlist(inner_plan, best_path->jpath.innerjoinpath);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user