1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

BUG#877288: Wrong result with semijoin + materialization + multipart key

- when create_ref_for_key() is constructing a ref access for
  a table that's inside a SJ-Materialization nest, it may not 
  use references to fields of tables that are unside the nest (because 
  these fields will not yet have values when ref access will be used)
  
  The check was performed in the first of create_ref_for_key's loops (the 
  one which counts how many key parts are usable) but not in the second
  (the one which actually fills the TABLE_REF structure).
This commit is contained in:
Sergey Petrunya
2011-10-26 02:38:49 +04:00
parent c0a1bd1ed6
commit 8e6440df0b
4 changed files with 83 additions and 1 deletions

View File

@ -7360,7 +7360,8 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j,
while (((~used_tables) & keyuse->used_tables) ||
(keyuse->keypart !=
(is_hash_join_key_no(key) ?
keyinfo->key_part[i].field->field_index : i)))
keyinfo->key_part[i].field->field_index : i)) ||
!are_tables_local(j, keyuse->val->used_tables()))
keyuse++; /* Skip other parts */
uint maybe_null= test(keyinfo->key_part[i].null_bit);