mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
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.
This commit is contained in:
parent
8940231491
commit
faa48bf1a0
2 changed files with 87 additions and 0 deletions
|
@ -1237,3 +1237,59 @@ a
|
|||
Käli Käli 2-4
|
||||
Käli Käli 2-4
|
||||
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));
|
|||
SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue