Skip to content

Commit f8536c5

Browse files
author
Ajo Robert
committed
Bug#25782811 5.6: WRONG RESULTS WITH MATERIALIZATION,
VIEWS Backport of Bug#21566735 fix. Analysis ======= create_ref_for_key() fails due to table not available for key_use when subquery optimization chooses materialization strategy and have a ref access key to one of the materialized table. This is due to JOIN::update_equalities_for_sjm() checks for real_item() of the materialized table expression with key_use->val of the primary table expresssion. Fix ==== When comparing key_use from materialized tables use key_use-> val->real_item() instead of key_use->val.
1 parent 064bedc commit f8536c5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sql/sql_optimizer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3024,7 +3024,7 @@ bool JOIN::update_equalities_for_sjm()
30243024
uint fieldno= 0;
30253025
while ((old= it++))
30263026
{
3027-
if (old->real_item()->eq(keyuse->val, false))
3027+
if (old->real_item()->eq(keyuse->val->real_item(), false))
30283028
{
30293029
/*
30303030
Replace the expression selected from the subquery with the

0 commit comments

Comments
 (0)