summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorigor@olga.mysql.com <>2007-06-25 22:44:22 -0700
committerigor@olga.mysql.com <>2007-06-25 22:44:22 -0700
commit6f98ec66b662fdc3fd035be962b824c1dcd172dc (patch)
treef09d03e32cc2cbaaeb0f1aa8edbac3fcefe511ef /myisam
parent802dcc7a457a69c7213cfb13da3377a9d4e5c20d (diff)
downloadmariadb-git-6f98ec66b662fdc3fd035be962b824c1dcd172dc.tar.gz
Fixed bug #29087. This bug manifested itself for queries that performed
a lookup into a BINARY index by a key ended with spaces. It caused an assertion abort for a debug version and wrong results for non-debug versions. The problem occurred because the function _mi_pack_key stripped off the trailing spaces from binary search keys while the function _mi_make_key did not do it when keys were inserted into the index. Now the function _mi_pack_key does not remove the trailing spaces from search keys if they are of the binary type.
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_key.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/myisam/mi_key.c b/myisam/mi_key.c
index b203286d544..377972b5a5f 100644
--- a/myisam/mi_key.c
+++ b/myisam/mi_key.c
@@ -252,16 +252,16 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
if (keyseg->flag & HA_SPACE_PACK)
{
uchar *end=pos+length;
- if (type != HA_KEYTYPE_NUM)
- {
- while (end > pos && end[-1] == ' ')
- end--;
- }
- else
+ if (type == HA_KEYTYPE_NUM)
{
while (pos < end && pos[0] == ' ')
pos++;
}
+ else if (type != HA_KEYTYPE_BINARY)
+ {
+ while (end > pos && end[-1] == ' ')
+ end--;
+ }
k_length-=length;
length=(uint) (end-pos);
FIX_LENGTH(cs, pos, length, char_length);