1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

BUG#24056: Crash in subquery:

Don't assume that condition that was pushed down into subquery has 
produced exactly one KEY_FIELD element - it could produce several or
none at all, handle all of those cases.
This commit is contained in:
sergefp@mysql.com
2006-11-08 02:26:50 +03:00
parent 28faf5e468
commit 26c30f2f7d

View File

@@ -2951,10 +2951,12 @@ add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level,
join->unit->item->substype() == Item_subselect::IN_SUBS && join->unit->item->substype() == Item_subselect::IN_SUBS &&
!join->unit->first_select()->next_select()) !join->unit->first_select()->next_select())
{ {
KEY_FIELD *save= *key_fields;
add_key_fields(join, key_fields, and_level, cond, usable_tables, add_key_fields(join, key_fields, and_level, cond, usable_tables,
sargables); sargables);
// Indicate that this ref access candidate is for subquery lookup: // Indicate that this ref access candidate is for subquery lookup:
(*key_fields)[-1].outer_ref= TRUE; for (; save != *key_fields; save++)
save->outer_ref= TRUE;
} }
return; return;
} }