Commit 65af83f6 authored by Neeraj Bisht's avatar Neeraj Bisht

Bug#11758009 - UNION EXECUTION ORDER WRONG ?

Problem:-
In case of blob data field, UNION ALL doesn't give correct result.

Analysis:-
In MyISAM table, when we dont want to check for the distinct for particular 
key, we set the key_map to zero.

While writing record in MyISAM table, we check the distinct with the help 
of keys, by checking whether that key is active in key_map and then writing 
the record.

In case of blob field, we are checking for distinct by unique constraint, 
where we are not checking whether that unique key is active or not in key_map.

Solution:-
Before checking for distinct, check whether any key is active in key_map.

storage/myisam/mi_write.c:
  check whether key_map is active before checking distinct.
parent 99645e5b
...@@ -90,12 +90,15 @@ int mi_write(MI_INFO *info, uchar *record) ...@@ -90,12 +90,15 @@ int mi_write(MI_INFO *info, uchar *record)
goto err2; goto err2;
/* Calculate and check all unique constraints */ /* Calculate and check all unique constraints */
for (i=0 ; i < share->state.header.uniques ; i++) if (mi_is_any_key_active(share->state.key_map))
{ {
if (mi_check_unique(info,share->uniqueinfo+i,record, for (i= 0 ; i < share->state.header.uniques ; i++)
mi_unique_hash(share->uniqueinfo+i,record), {
HA_OFFSET_ERROR)) if (mi_check_unique(info, share->uniqueinfo + i, record,
goto err2; mi_unique_hash(share->uniqueinfo + i, record),
HA_OFFSET_ERROR))
goto err2;
}
} }
/* Write all keys to indextree */ /* Write all keys to indextree */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment