diff options
author | Igor Babaev <igor@askmonty.org> | 2011-01-27 21:23:02 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2011-01-27 21:23:02 -0800 |
commit | d492903502f2c584a063609e9a77cd25d1e50335 (patch) | |
tree | 19910cbd20c48c33c766b7afb3b90fef5d3e87d4 /sql/key.cc | |
parent | 3e868cd3cb2f9b9a851799deecf3e37db9b58dbb (diff) | |
download | mariadb-git-d492903502f2c584a063609e9a77cd25d1e50335.tar.gz |
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.
Diffstat (limited to 'sql/key.cc')
-rw-r--r-- | sql/key.cc | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/sql/key.cc b/sql/key.cc index fd5c129eee8..19db7e9ec1f 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -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++; } |