diff options
author | unknown <monty@mashka.mysql.fi> | 2002-12-27 21:39:35 +0200 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2002-12-27 21:39:35 +0200 |
commit | d78c9adb55a7f43bc234cfbf818ce8183ec73daf (patch) | |
tree | 80868d909a3253f702316058295646695044c0d3 /myisam/mi_unique.c | |
parent | 22611051945dc581414895086bd114dd597f69c7 (diff) | |
download | mariadb-git-d78c9adb55a7f43bc234cfbf818ce8183ec73daf.tar.gz |
Fixed max_key_length when using UNIQUE keys.
This fixed a bug in GROUP BY on a BLOB column with NULL values.
myisam/mi_create.c:
Fixed max_key_length when using UNIQUE keys.
myisam/mi_unique.c:
Simple optimization
Make different CRC for keys with null and empty strings.
mysql-test/r/group_by.result:
Updated results
mysql-test/t/group_by.test:
Test of bug
Diffstat (limited to 'myisam/mi_unique.c')
-rw-r--r-- | myisam/mi_unique.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/myisam/mi_unique.c b/myisam/mi_unique.c index e598fbeedb4..7f1e6b83a12 100644 --- a/myisam/mi_unique.c +++ b/myisam/mi_unique.c @@ -24,7 +24,7 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record, { my_off_t lastpos=info->lastpos; MI_KEYDEF *key= &info->s->keyinfo[def->key]; - uchar *key_buff=info->lastkey+info->s->base.max_key_length; + uchar *key_buff=info->lastkey2; DBUG_ENTER("mi_check_unique"); mi_unique_store(record+key->seg->start, unique_hash); @@ -80,7 +80,16 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record) if (keyseg->null_bit) { if (record[keyseg->null_pos] & keyseg->null_bit) + { + /* + Change crc in a way different from an empty string or 0. + (This is an optimisation; The code will work even if this isn't + done) + */ + crc=((crc << 8) + 511+ + (crc >> (8*sizeof(ha_checksum)-8))); continue; + } } pos= record+keyseg->start; if (keyseg->flag & HA_VAR_LENGTH) |