Fixed LP bug #707827.

This bug could manifest itself when hash join over a varchar column
with NULL values in some rows was used. It happened because the
function key_buf_cmp erroneously returned FALSE when one of the joined
key fields was null while the second was not.
Also fixed two other bugs in the functions key_hashnr and key_buf_cmp 
that could possibly lead to wrong results for some queries that
used hash join over several columns with nulls.
Also reverted the latest addition of the test case for bug #45092. It
had been already backported earlier.
This commit is contained in:
Igor Babaev 2011-01-27 21:23:02 -08:00
commit d492903502
3 changed files with 48 additions and 36 deletions

View file

@ -663,8 +663,6 @@ ulong key_hashnr(KEY *key_info, uint used_key_parts, const uchar *key)
switch (key_part->type) {
case HA_KEYTYPE_VARTEXT1:
case HA_KEYTYPE_VARBINARY1:
key++;
break;
case HA_KEYTYPE_VARTEXT2:
case HA_KEYTYPE_VARBINARY2:
key+= 2;
@ -769,8 +767,6 @@ bool key_buf_cmp(KEY *key_info, uint used_key_parts,
switch (key_part->type) {
case HA_KEYTYPE_VARTEXT1:
case HA_KEYTYPE_VARBINARY1:
key1++; key2++;
break;
case HA_KEYTYPE_VARTEXT2:
case HA_KEYTYPE_VARBINARY2:
key1+= 2; key2+= 2;
@ -778,10 +774,10 @@ bool key_buf_cmp(KEY *key_info, uint used_key_parts,
default:
;
}
continue;
continue;
}
if (*pos1 != *pos2)
return FALSE;
return TRUE;
pos1++; pos2++;
}