mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-13535 Query on MyISAM table corrupts the table
don't assume that the table always has a primary key, head->s->primary_key might be MAX_KEY, which won't start keyread.
This commit is contained in:
@@ -64,6 +64,8 @@ explain
|
|||||||
select * from t0 where key1 < 3 or key2 > 1020;
|
select * from t0 where key1 < 3 or key2 > 1020;
|
||||||
select * from t0 where key1 < 3 or key2 > 1020;
|
select * from t0 where key1 < 3 or key2 > 1020;
|
||||||
|
|
||||||
|
select * from t0 where key1=1022; # MDEV-13535 no-key-read select after keyread
|
||||||
|
|
||||||
explain select * from t0 where key1 < 3 or key2 <4;
|
explain select * from t0 where key1 < 3 or key2 <4;
|
||||||
|
|
||||||
explain
|
explain
|
||||||
|
@@ -34,6 +34,9 @@ key1 key2 key3 key4 key5 key6 key7 key8
|
|||||||
1022 1022 1022 1022 1022 1022 1022 2
|
1022 1022 1022 1022 1022 1022 1022 2
|
||||||
1023 1023 1023 1023 1023 1023 1023 1
|
1023 1023 1023 1023 1023 1023 1023 1
|
||||||
1024 1024 1024 1024 1024 1024 1024 0
|
1024 1024 1024 1024 1024 1024 1024 0
|
||||||
|
select * from t0 where key1=1022;
|
||||||
|
key1 key2 key3 key4 key5 key6 key7 key8
|
||||||
|
1022 1022 1022 1022 1022 1022 1022 2
|
||||||
explain select * from t0 where key1 < 3 or key2 <4;
|
explain select * from t0 where key1 < 3 or key2 <4;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 7 Using sort_union(i1,i2); Using where
|
1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 7 Using sort_union(i1,i2); Using where
|
||||||
|
@@ -10889,13 +10889,13 @@ int read_keys_and_merge_scans(THD *thd,
|
|||||||
DBUG_ENTER("read_keys_and_merge");
|
DBUG_ENTER("read_keys_and_merge");
|
||||||
|
|
||||||
/* We're going to just read rowids. */
|
/* We're going to just read rowids. */
|
||||||
head->file->ha_start_keyread(head->s->primary_key);
|
|
||||||
head->prepare_for_position();
|
head->prepare_for_position();
|
||||||
|
|
||||||
cur_quick_it.rewind();
|
cur_quick_it.rewind();
|
||||||
cur_quick= cur_quick_it++;
|
cur_quick= cur_quick_it++;
|
||||||
bool first_quick= TRUE;
|
bool first_quick= TRUE;
|
||||||
DBUG_ASSERT(cur_quick != 0);
|
DBUG_ASSERT(cur_quick != 0);
|
||||||
|
head->file->ha_start_keyread(cur_quick->index);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
We reuse the same instance of handler so we need to call both init and
|
We reuse the same instance of handler so we need to call both init and
|
||||||
|
Reference in New Issue
Block a user