Commit d62551af authored by unknown's avatar unknown

Added a test case for bug #18359.

This was another manifestation of the problems fixed in the
patch for bug 16674.
Wrong calculation of length of the search prefix in the pattern
string led here to a wrong result set for a query in 4.1. 
The bug could be demonstrated for any multi-byte character set. 


mysql-test/r/ctype_utf8.result:
  Added a test case for bug #18359.
mysql-test/t/ctype_utf8.test:
  Added a test case for bug #18359.
parent e8adb499
...@@ -1237,3 +1237,59 @@ a ...@@ -1237,3 +1237,59 @@ a
Käli Käli 2-4 Käli Käli 2-4
Käli Käli 2-4 Käli Käli 2-4
DROP TABLE t1; DROP TABLE t1;
SET NAMES latin2;
CREATE TABLE t1 (
id int(11) NOT NULL default '0',
tid int(11) NOT NULL default '0',
val text NOT NULL,
INDEX idx(tid, val(10))
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES
(40988,72,'VOLN ADSL'),(41009,72,'VOLN ADSL'),
(41032,72,'VOLN ADSL'),(41038,72,'VOLN ADSL'),
(41063,72,'VOLN ADSL'),(41537,72,'VOLN ADSL Office'),
(42141,72,'VOLN ADSL'),(42565,72,'VOLN ADSL Combi'),
(42749,72,'VOLN ADSL'),(44205,72,'VOLN ADSL');
SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLNY ADSL';
id tid val
40988 72 VOLN ADSL
41009 72 VOLN ADSL
41032 72 VOLN ADSL
41038 72 VOLN ADSL
41063 72 VOLN ADSL
42141 72 VOLN ADSL
42749 72 VOLN ADSL
44205 72 VOLN ADSL
SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLN ADSL';
id tid val
40988 72 VOLN ADSL
41009 72 VOLN ADSL
41032 72 VOLN ADSL
41038 72 VOLN ADSL
41063 72 VOLN ADSL
42141 72 VOLN ADSL
42749 72 VOLN ADSL
44205 72 VOLN ADSL
SELECT * FROM t1 WHERE tid=72 and val LIKE '%VOLN ADSL';
id tid val
40988 72 VOLN ADSL
41009 72 VOLN ADSL
41032 72 VOLN ADSL
41038 72 VOLN ADSL
41063 72 VOLN ADSL
42141 72 VOLN ADSL
42749 72 VOLN ADSL
44205 72 VOLN ADSL
ALTER TABLE t1 DROP KEY idx;
ALTER TABLE t1 ADD KEY idx (tid,val(11));
SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLN ADSL';
id tid val
40988 72 VOLN ADSL
41009 72 VOLN ADSL
41032 72 VOLN ADSL
41038 72 VOLN ADSL
41063 72 VOLN ADSL
42141 72 VOLN ADSL
42749 72 VOLN ADSL
44205 72 VOLN ADSL
DROP TABLE t1;
...@@ -1009,4 +1009,35 @@ ALTER TABLE t1 ADD KEY (a(10)); ...@@ -1009,4 +1009,35 @@ ALTER TABLE t1 ADD KEY (a(10));
SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%'; SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
DROP TABLE t1; DROP TABLE t1;
#
# Bug#18359: LIKE predicate for a 'utf8' text column with a partial index
# (see bug #16674 as well)
#
SET NAMES latin2;
CREATE TABLE t1 (
id int(11) NOT NULL default '0',
tid int(11) NOT NULL default '0',
val text NOT NULL,
INDEX idx(tid, val(10))
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES
(40988,72,'VOLN ADSL'),(41009,72,'VOLN ADSL'),
(41032,72,'VOLN ADSL'),(41038,72,'VOLN ADSL'),
(41063,72,'VOLN ADSL'),(41537,72,'VOLN ADSL Office'),
(42141,72,'VOLN ADSL'),(42565,72,'VOLN ADSL Combi'),
(42749,72,'VOLN ADSL'),(44205,72,'VOLN ADSL');
SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLNY ADSL';
SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLN ADSL';
SELECT * FROM t1 WHERE tid=72 and val LIKE '%VOLN ADSL';
ALTER TABLE t1 DROP KEY idx;
ALTER TABLE t1 ADD KEY idx (tid,val(11));
SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLN ADSL';
DROP TABLE t1;
# End of 4.1 tests # End of 4.1 tests
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