Commit c326c649 authored by unknown's avatar unknown

Fix replace bug w/ BDB tables by passing key_length to index_read_idx.


mysql-test/t/replace.test:
  - test replace with an extra row that has a higher key value
sql/sql_insert.cc:
  - pass real key length to index_read_idx, instead of relying on the
    table handler to convert 0 -> key_length (fixes replace bug in BDB)
parent 4a1f883b
...@@ -10,6 +10,7 @@ CREATE TABLE t1 ( ...@@ -10,6 +10,7 @@ CREATE TABLE t1 (
PRIMARY KEY (gesuchnr,benutzer_id) PRIMARY KEY (gesuchnr,benutzer_id)
) type=ISAM; ) type=ISAM;
replace into t1 (gesuchnr,benutzer_id) values (2,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1); replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1); replace into t1 (gesuchnr,benutzer_id) values (1,1);
alter table t1 type=myisam; alter table t1 type=myisam;
......
...@@ -366,7 +366,8 @@ int write_record(TABLE *table,COPY_INFO *info) ...@@ -366,7 +366,8 @@ int write_record(TABLE *table,COPY_INFO *info)
} }
key_copy((byte*) key,table,key_nr,0); key_copy((byte*) key,table,key_nr,0);
if ((error=(table->file->index_read_idx(table->record[1],key_nr, if ((error=(table->file->index_read_idx(table->record[1],key_nr,
(byte*) key,0, (byte*) key,
table->key_info[key_nr].key_length,
HA_READ_KEY_EXACT)))) HA_READ_KEY_EXACT))))
goto err; goto err;
} }
......
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