summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <istruewing@stella.local>2007-12-18 12:29:50 +0100
committerunknown <istruewing@stella.local>2007-12-18 12:29:50 +0100
commit53f762abfd26e432477016f00cd984e2c6c9e2d1 (patch)
tree132e87de113a7b7e943c1e330ce00d8bde2279ab /myisam
parent0ced2a4d19839417ca6a6d6c8cc9c5cba259ef76 (diff)
downloadmariadb-git-53f762abfd26e432477016f00cd984e2c6c9e2d1.tar.gz
Bug#32705 - myisam corruption: Key in wrong position
at page 1024 with ucs2_bin Inserting strings with a common prefix into a table with characterset UCS2 corrupted the table. An efficient search method was used, which compares end space with ASCII blank. This doesn't work for character sets like UCS2, which do not encode blank like ASCII does. Use the less efficient search method _mi_seq_search() for charsets with mbminlen > 1. myisam/mi_open.c: Bug#32705 - myisam corruption: Key in wrong position at page 1024 with ucs2_bin Use _mi_seq_search() for charsets with mbminlen > 1. mysql-test/r/myisam.result: Bug#32705 - myisam corruption: Key in wrong position at page 1024 with ucs2_bin Added test result. mysql-test/t/myisam.test: Bug#32705 - myisam corruption: Key in wrong position at page 1024 with ucs2_bin Added test.
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_open.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/myisam/mi_open.c b/myisam/mi_open.c
index ec169ac8785..5314d6a9a6c 100644
--- a/myisam/mi_open.c
+++ b/myisam/mi_open.c
@@ -791,8 +791,17 @@ static void setup_key_functions(register MI_KEYDEF *keyinfo)
keyinfo->get_key= _mi_get_pack_key;
if (keyinfo->seg[0].flag & HA_PACK_KEY)
{ /* Prefix compression */
+ /*
+ _mi_prefix_search() compares end-space against ASCII blank (' ').
+ It cannot be used for character sets, that do not encode the
+ blank character like ASCII does. UCS2 is an example. All
+ character sets with a fixed width > 1 or a mimimum width > 1
+ cannot represent blank like ASCII does. In these cases we have
+ to use _mi_seq_search() for the search.
+ */
if (!keyinfo->seg->charset || use_strnxfrm(keyinfo->seg->charset) ||
- (keyinfo->seg->flag & HA_NULL_PART))
+ (keyinfo->seg->flag & HA_NULL_PART) ||
+ (keyinfo->seg->charset->mbminlen > 1))
keyinfo->bin_search=_mi_seq_search;
else
keyinfo->bin_search=_mi_prefix_search;