mirror of
https://github.com/postgres/postgres.git
synced 2025-05-08 07:21:33 +03:00
Build HashState's hashkeys expression with the correct parent.
Previously the expressions were built with the HashJoinState as a parent. That's incorrect. Currently this does not appear to be harmful, but for the upcoming 'slot abstraction' work this proves to be problematic, as the underlying slot types can differ between Hash and HashJoin. It's possible that this already causes a problem, but I've not been able to come up with a scenario. Therefore don't backpatch at this point. Author: Andres Freund Discussion: https://postgr.es/m/20180220224318.gw4oe5jadhpmcdnm@alap3.anarazel.de
This commit is contained in:
parent
da906766cd
commit
5f32b29c18
@ -595,6 +595,7 @@ ExecInitHashJoin(HashJoin *node, EState *estate, int eflags)
|
|||||||
Hash *hashNode;
|
Hash *hashNode;
|
||||||
List *lclauses;
|
List *lclauses;
|
||||||
List *rclauses;
|
List *rclauses;
|
||||||
|
List *rhclauses;
|
||||||
List *hoperators;
|
List *hoperators;
|
||||||
TupleDesc outerDesc,
|
TupleDesc outerDesc,
|
||||||
innerDesc;
|
innerDesc;
|
||||||
@ -726,6 +727,7 @@ ExecInitHashJoin(HashJoin *node, EState *estate, int eflags)
|
|||||||
*/
|
*/
|
||||||
lclauses = NIL;
|
lclauses = NIL;
|
||||||
rclauses = NIL;
|
rclauses = NIL;
|
||||||
|
rhclauses = NIL;
|
||||||
hoperators = NIL;
|
hoperators = NIL;
|
||||||
foreach(l, node->hashclauses)
|
foreach(l, node->hashclauses)
|
||||||
{
|
{
|
||||||
@ -735,13 +737,15 @@ ExecInitHashJoin(HashJoin *node, EState *estate, int eflags)
|
|||||||
(PlanState *) hjstate));
|
(PlanState *) hjstate));
|
||||||
rclauses = lappend(rclauses, ExecInitExpr(lsecond(hclause->args),
|
rclauses = lappend(rclauses, ExecInitExpr(lsecond(hclause->args),
|
||||||
(PlanState *) hjstate));
|
(PlanState *) hjstate));
|
||||||
|
rhclauses = lappend(rhclauses, ExecInitExpr(lsecond(hclause->args),
|
||||||
|
innerPlanState(hjstate)));
|
||||||
hoperators = lappend_oid(hoperators, hclause->opno);
|
hoperators = lappend_oid(hoperators, hclause->opno);
|
||||||
}
|
}
|
||||||
hjstate->hj_OuterHashKeys = lclauses;
|
hjstate->hj_OuterHashKeys = lclauses;
|
||||||
hjstate->hj_InnerHashKeys = rclauses;
|
hjstate->hj_InnerHashKeys = rclauses;
|
||||||
hjstate->hj_HashOperators = hoperators;
|
hjstate->hj_HashOperators = hoperators;
|
||||||
/* child Hash node needs to evaluate inner hash keys, too */
|
/* child Hash node needs to evaluate inner hash keys, too */
|
||||||
((HashState *) innerPlanState(hjstate))->hashkeys = rclauses;
|
((HashState *) innerPlanState(hjstate))->hashkeys = rhclauses;
|
||||||
|
|
||||||
hjstate->hj_JoinState = HJ_BUILD_HASHTABLE;
|
hjstate->hj_JoinState = HJ_BUILD_HASHTABLE;
|
||||||
hjstate->hj_MatchedOuter = false;
|
hjstate->hj_MatchedOuter = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user