Commit 9b39f830 authored by monty@mysql.com's avatar monty@mysql.com

Fixed wrong buffer usage for auto-increment key with blob part that caused...

Fixed wrong buffer usage for auto-increment key with blob part that caused CHECK TABLE to report that the table was wrong. (Bug #10045)
parent 20f969b2
......@@ -255,8 +255,25 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
} /* _mi_pack_key */
/* Put a key in record */
/* Used when only-keyread is wanted */
/*
Store found key in record
SYNOPSIS
_mi_put_key_in_record()
info MyISAM handler
keynr Key number that was used
record Store key here
Last read key is in info->lastkey
NOTES
Used when only-keyread is wanted
RETURN
0 ok
1 error
*/
static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
byte *record)
......@@ -267,14 +284,8 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
byte *blob_ptr;
DBUG_ENTER("_mi_put_key_in_record");
if (info->s->base.blobs && info->s->keyinfo[keynr].flag & HA_VAR_LENGTH_KEY)
{
if (!(blob_ptr=
mi_alloc_rec_buff(info, info->s->keyinfo[keynr].keylength,
&info->rec_buff)))
goto err;
}
key=(byte*) info->lastkey;
blob_ptr= info->lastkey2; /* Place to put blob parts */
key=(byte*) info->lastkey; /* KEy that was read */
key_end=key+info->lastkey_length;
for (keyseg=info->s->keyinfo[keynr].seg ; keyseg->type ;keyseg++)
{
......
......@@ -131,3 +131,17 @@ a
1
2
drop table t1;
CREATE TABLE t1 ( a INT AUTO_INCREMENT, b BLOB, PRIMARY KEY (a,b(10)));
INSERT INTO t1 (b) VALUES ('aaaa');
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
INSERT INTO t1 (b) VALUES ('');
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
INSERT INTO t1 (b) VALUES ('bbbb');
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE IF EXISTS t1;
......@@ -89,3 +89,15 @@ select last_insert_id();
insert into t1 values (NULL);
select * from t1;
drop table t1;
#
# BUG #10045: Problem with composite AUTO_INCREMENT + BLOB key
CREATE TABLE t1 ( a INT AUTO_INCREMENT, b BLOB, PRIMARY KEY (a,b(10)));
INSERT INTO t1 (b) VALUES ('aaaa');
CHECK TABLE t1;
INSERT INTO t1 (b) VALUES ('');
CHECK TABLE t1;
INSERT INTO t1 (b) VALUES ('bbbb');
CHECK TABLE t1;
DROP TABLE IF EXISTS t1;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment