diff options
-rw-r--r-- | myisam/mi_search.c | 5 | ||||
-rw-r--r-- | mysql-test/r/myisam.result | 16 | ||||
-rw-r--r-- | mysql-test/t/myisam.test | 12 |
3 files changed, 30 insertions, 3 deletions
diff --git a/myisam/mi_search.c b/myisam/mi_search.c index 24f5db1401d..bc8be9c2732 100644 --- a/myisam/mi_search.c +++ b/myisam/mi_search.c @@ -451,9 +451,8 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, /* We have to compare k and vseg as if they where space extended */ for (end=vseg + (len-cmplen) ; vseg < end && *vseg == (uchar) ' '; - vseg++) ; - if (vseg == end) - goto cmp_rest; /* should never happen */ + vseg++, matched++) ; + DBUG_ASSERT(vseg < end); if (*vseg > (uchar) ' ') { diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 354675cd4d4..26dcce43d08 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -428,6 +428,22 @@ select * from t1 where a='807780' and b='477' and c='165'; a b c 807780 477 165 drop table t1; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (a varchar(150) NOT NULL, KEY (a)); +INSERT t1 VALUES ("can \tcan"); +INSERT t1 VALUES ("can can"); +INSERT t1 VALUES ("can"); +SELECT * FROM t1; +a +can can +can +can can +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; create table t1 (a blob); insert into t1 values('a '),('a'); select concat(a,'.') from t1 where a='a'; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index e6d47b5c570..f9081e8769b 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -423,6 +423,18 @@ select * from t1 where a='807780' and b='477' and c='165'; drop table t1; # +# space-stripping in _mi_prefix_search: BUG#5284 +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a varchar(150) NOT NULL, KEY (a)); +INSERT t1 VALUES ("can \tcan"); +INSERT t1 VALUES ("can can"); +INSERT t1 VALUES ("can"); +SELECT * FROM t1; +CHECK TABLE t1; +DROP TABLE t1; + +# # Verify blob handling # create table t1 (a blob); |