diff --git a/mysql-test/r/maria.result b/mysql-test/r/maria.result index 87334c64ca3b988fbba2abafaa4cd9f57e78d209..1973ecdaa95595758babf5a2daaca3451128be15 100644 --- a/mysql-test/r/maria.result +++ b/mysql-test/r/maria.result @@ -1900,9 +1900,6 @@ check table t2 extended; Table Op Msg_type Msg_text test.t2 check status OK drop table t2; -drop table if exists t1; -Warnings: -Note 1051 Unknown table 't1' CREATE TABLE t1 ( col0 float DEFAULT NULL, col1 date DEFAULT NULL, @@ -2080,7 +2077,7 @@ col172 tinyint(1) DEFAULT NULL, col173 tinytext, col174 decimal(10,0) DEFAULT NULL, col175 double DEFAULT NULL -) engine=maria DEFAULT CHARSET=latin1 COMMENT='generated'; +) engine=maria; insert ignore into t1 set col10=abs(28449) % 2, col11='1973', @@ -2205,3 +2202,23 @@ check table t1; Table Op Msg_type Msg_text test.t1 check status OK drop table t1; +create table t1 (a char(200) primary key, b int default 12345) engine=maria; +insert t1 (a) values (repeat('0', 200)); +insert t1 (a) values (repeat('1', 200)), (repeat('2', 200)), (repeat('3', 200)), +(repeat('4', 200)), (repeat('5', 200)), (repeat('6', 200)), (repeat('7', 200)), +(repeat('8', 200)), (repeat('9', 200)), (repeat('a', 200)), (repeat('b', 200)), +(repeat('c', 200)), (repeat('d', 200)), (repeat('e', 200)), (repeat('f', 200)), +(repeat('g', 200)), (repeat('h', 200)), (repeat('i', 200)), (repeat('j', 200)), +(repeat('k', 200)), (repeat('l', 200)), (repeat('m', 200)), (repeat('n', 200)), +(repeat('o', 200)), (repeat('p', 200)), (repeat('q', 200)), (repeat('r', 200)), +(repeat('s', 200)), (repeat('t', 200)), (repeat('u', 200)), (repeat('v', 200)), +(repeat('w', 200)), (repeat('x', 200)), (repeat('y', 200)), (repeat('z', 200)), +(repeat('+', 200)), (repeat('-', 200)), (repeat('=', 200)), (repeat('*', 200)); +select b from t1 where a >= repeat('f', 200) and a < 'k'; +b +12345 +12345 +12345 +12345 +12345 +drop table t1; diff --git a/mysql-test/t/maria.test b/mysql-test/t/maria.test index bafa7a17df659e1f9ddcdad64110e8908b60b193..6768ed928a6e2d4c040866b025536442f49aefad 100644 --- a/mysql-test/t/maria.test +++ b/mysql-test/t/maria.test @@ -1186,7 +1186,6 @@ insert into t2 values (repeat('x',28)), (repeat('p',21)), (repeat('k',241)), check table t2 extended; drop table t2; -drop table if exists t1; CREATE TABLE t1 ( col0 float DEFAULT NULL, col1 date DEFAULT NULL, @@ -1364,8 +1363,7 @@ col172 tinyint(1) DEFAULT NULL, col173 tinytext, col174 decimal(10,0) DEFAULT NULL, col175 double DEFAULT NULL -) engine=maria DEFAULT CHARSET=latin1 COMMENT='generated'; - +) engine=maria; insert ignore into t1 set col10=abs(28449) % 2, @@ -1481,6 +1479,25 @@ update ignore t1 set col165=repeat('a',7000); check table t1; drop table t1; +# +# Bug#38466 maria: range query returns no data +# + +create table t1 (a char(200) primary key, b int default 12345) engine=maria; +insert t1 (a) values (repeat('0', 200)); +insert t1 (a) values (repeat('1', 200)), (repeat('2', 200)), (repeat('3', 200)), + (repeat('4', 200)), (repeat('5', 200)), (repeat('6', 200)), (repeat('7', 200)), + (repeat('8', 200)), (repeat('9', 200)), (repeat('a', 200)), (repeat('b', 200)), + (repeat('c', 200)), (repeat('d', 200)), (repeat('e', 200)), (repeat('f', 200)), + (repeat('g', 200)), (repeat('h', 200)), (repeat('i', 200)), (repeat('j', 200)), + (repeat('k', 200)), (repeat('l', 200)), (repeat('m', 200)), (repeat('n', 200)), + (repeat('o', 200)), (repeat('p', 200)), (repeat('q', 200)), (repeat('r', 200)), + (repeat('s', 200)), (repeat('t', 200)), (repeat('u', 200)), (repeat('v', 200)), + (repeat('w', 200)), (repeat('x', 200)), (repeat('y', 200)), (repeat('z', 200)), + (repeat('+', 200)), (repeat('-', 200)), (repeat('=', 200)), (repeat('*', 200)); +select b from t1 where a >= repeat('f', 200) and a < 'k'; +drop table t1; + --disable_result_log --disable_query_log eval set global storage_engine=$default_engine, maria_page_checksum=$default_checksum; diff --git a/storage/maria/ma_search.c b/storage/maria/ma_search.c index 98bac11e8d46f454d9b2e48a72b796d40eaff197..8b0c0426f1bd599355fa08f069837a10e76421c3 100644 --- a/storage/maria/ma_search.c +++ b/storage/maria/ma_search.c @@ -116,7 +116,8 @@ int _ma_search(register MARIA_HA *info, MARIA_KEY *key, uint32 nextflag, ((keyinfo->flag & (HA_NOSAME | HA_NULL_PART)) != HA_NOSAME || (key->flag & SEARCH_PART_KEY) || info->s->base.born_transactional)) { - if ((error= _ma_search(info, key, nextflag, + if ((error= _ma_search(info, key, (nextflag | SEARCH_FIND) & + ~(SEARCH_BIGGER | SEARCH_SMALLER | SEARCH_LAST), _ma_kpos(nod_flag,keypos))) >= 0 || my_errno != HA_ERR_KEY_NOT_FOUND) DBUG_RETURN(error); @@ -338,10 +339,8 @@ int _ma_seq_search(const MARIA_KEY *key, uchar *page, comp_flag | tmp_key.flag, not_used)) >= 0) break; -#ifdef EXTRA_DEBUG - DBUG_PRINT("loop",("page: 0x%lx key: '%s' flag: %d", (long) page, t_buff, - flag)); -#endif + DBUG_PRINT("loop_extra",("page: 0x%lx key: '%s' flag: %d", + (long) page, t_buff, flag)); memcpy(buff,t_buff,length); *ret_pos=page; }