Current Path : /home/usr.opt/mysql57/mysql-test/r/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : /home/usr.opt/mysql57/mysql-test/r/func_like.result |
drop table if exists t1; create table t1 (a varchar(10), key(a)); insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); explain extended select * from t1 where a like 'abc%'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL range a a 13 NULL 1 100.00 Using where; Using index Warnings: Warning 1681 'EXTENDED' is deprecated and will be removed in a future release. Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` like 'abc%') explain extended select * from t1 where a like concat('abc','%'); id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL range a a 13 NULL 1 100.00 Using where; Using index Warnings: Warning 1681 'EXTENDED' is deprecated and will be removed in a future release. Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` like <cache>(concat('abc','%'))) select * from t1 where a like "abc%"; a abc abcd select * from t1 where a like concat("abc","%"); a abc abcd select * from t1 where a like "ABC%"; a abc abcd select * from t1 where a like "test%"; a test select * from t1 where a like "te_t"; a test select * from t1 where a like "%a%"; a a abc abcd select * from t1 where a like "%abcd%"; a abcd select * from t1 where a like "%abc\d%"; a abcd drop table t1; create table t1 (a varchar(10), key(a)); insert into t1 values ('a'), ('a\\b'); select * from t1 where a like 'a\\%' escape '#'; a a\b select * from t1 where a like 'a\\%' escape '#' and a like 'a\\\\b'; a a\b prepare stmt1 from 'select * from t1 where a like \'a\\%\' escape ?'; set @esc='#'; execute stmt1 using @esc; a a\b deallocate prepare stmt1; drop table t1; create table t1 (a datetime); insert into t1 values ('2004-03-11 12:00:21'); select * from t1 where a like '2004-03-11 12:00:21'; a 2004-03-11 12:00:21 drop table t1; SET NAMES koi8r; CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET koi8r); INSERT INTO t1 VALUES ('фыва'),('Фыва'),('фЫва'),('фыВа'),('фывА'),('ФЫВА'); INSERT INTO t1 VALUES ('фывапролдж'),('Фывапролдж'),('фЫвапролдж'),('фыВапролдж'); INSERT INTO t1 VALUES ('фывАпролдж'),('фываПролдж'),('фывапРолдж'),('фывапрОлдж'); INSERT INTO t1 VALUES ('фывапроЛдж'),('фывапролДж'),('фывапролдЖ'),('ФЫВАПРОЛДЖ'); SELECT * FROM t1 WHERE a LIKE '%фЫва%'; a фыва Фыва фЫва фыВа фывА ФЫВА фывапролдж Фывапролдж фЫвапролдж фыВапролдж фывАпролдж фываПролдж фывапРолдж фывапрОлдж фывапроЛдж фывапролДж фывапролдЖ ФЫВАПРОЛДЖ SELECT * FROM t1 WHERE a LIKE '%фЫв%'; a фыва Фыва фЫва фыВа фывА ФЫВА фывапролдж Фывапролдж фЫвапролдж фыВапролдж фывАпролдж фываПролдж фывапРолдж фывапрОлдж фывапроЛдж фывапролДж фывапролдЖ ФЫВАПРОЛДЖ SELECT * FROM t1 WHERE a LIKE 'фЫва%'; a фыва Фыва фЫва фыВа фывА ФЫВА фывапролдж Фывапролдж фЫвапролдж фыВапролдж фывАпролдж фываПролдж фывапРолдж фывапрОлдж фывапроЛдж фывапролДж фывапролдЖ ФЫВАПРОЛДЖ DROP TABLE t1; SET NAMES cp1250; CREATE TABLE t1 (a varchar(250) NOT NULL) DEFAULT CHARACTER SET=cp1250; INSERT INTO t1 VALUES ('Techni Tapes Sp. z o.o.'), ('Pojazdy Szynowe PESA Bydgoszcz SA Holding'), ('AKAPESTER 1 P.P.H.U.'), ('Pojazdy Szynowe PESA Bydgoszcz S A Holding'), ('PPUH PESKA-I Maria Struniarska'); select * from t1 where a like '%PESA%'; a Pojazdy Szynowe PESA Bydgoszcz SA Holding Pojazdy Szynowe PESA Bydgoszcz S A Holding select * from t1 where a like '%PESA %'; a Pojazdy Szynowe PESA Bydgoszcz SA Holding Pojazdy Szynowe PESA Bydgoszcz S A Holding select * from t1 where a like '%PES%'; a Techni Tapes Sp. z o.o. Pojazdy Szynowe PESA Bydgoszcz SA Holding AKAPESTER 1 P.P.H.U. Pojazdy Szynowe PESA Bydgoszcz S A Holding PPUH PESKA-I Maria Struniarska select * from t1 where a like '%PESKA%'; a PPUH PESKA-I Maria Struniarska select * from t1 where a like '%ESKA%'; a PPUH PESKA-I Maria Struniarska DROP TABLE t1; select _cp866'aaaaaaaaa' like _cp866'%aaaa%' collate cp866_bin; _cp866'aaaaaaaaa' like _cp866'%aaaa%' collate cp866_bin 1 set names koi8r; select 'andre%' like 'andreй%' escape 'й'; 'andre%' like 'andreй%' escape 'й' 1 select _cp1251'andre%' like convert('andreй%' using cp1251) escape 'й'; _cp1251'andre%' like convert('andreй%' using cp1251) escape 'й' 1 End of 4.1 tests # # Bug #54575: crash when joining tables with unique set column # CREATE TABLE t1(a SET('a') NOT NULL, UNIQUE KEY(a)); CREATE TABLE t2(b INT PRIMARY KEY); INSERT IGNORE INTO t1 VALUES (); Warnings: Warning 1364 Field 'a' doesn't have a default value INSERT INTO t2 VALUES (1), (2), (3); SELECT 1 FROM t2 JOIN t1 ON 1 LIKE a GROUP BY a; 1 DROP TABLE t1, t2; # # Bug#59149 valgrind warnings with "like .. escape .." function # SELECT '' LIKE '1' ESCAPE COUNT(1); ERROR HY000: Incorrect arguments to ESCAPE End of 5.1 tests # # Bug #18114294 CRASH IN ITEM_FUNC_LIKE::BM_MATCHES # select 0x0000000001020003F03F40408484040ADDE40 like 0x256F3B38312A7725; 0x0000000001020003F03F40408484040ADDE40 like 0x256F3B38312A7725 0 select 0x003c8793403032 like '%-112%'; 0x003c8793403032 like '%-112%' 0 select 0x903f645a8c507dd79178 like '%-128%'; 0x903f645a8c507dd79178 like '%-128%' 0 select 0xac14aa84f000d276d66ed9 like '%-107%'; 0xac14aa84f000d276d66ed9 like '%-107%' 0 select 0xf0be117400d02a20b8e049da3e74 like '%-123%'; 0xf0be117400d02a20b8e049da3e74 like '%-123%' 0 select 0x961838f6fc3c7f9ec17b5d900410d8aa like '%-113%'; 0x961838f6fc3c7f9ec17b5d900410d8aa like '%-113%' 0 select 0x6a8473fc1c64ce4f2684c05a400c5e7ca4a01a like '%emailin%'; 0x6a8473fc1c64ce4f2684c05a400c5e7ca4a01a like '%emailin%' 0 select 0x00b25278956e0044683dfc180cd886aeff2f5bc3fc18 like '%-122%'; 0x00b25278956e0044683dfc180cd886aeff2f5bc3fc18 like '%-122%' 0 select 0xbc24421ce6194ab5c260e80af647ae58fdbfca18a19dc8411424 like '%-106%'; 0xbc24421ce6194ab5c260e80af647ae58fdbfca18a19dc8411424 like '%-106%' 0 # # Bug#19931126 VALGRIND REPORTS USE OF UNINITIALIZED VALUE IN # MY_WILDCMP_BIN_IMPL # CREATE TABLE t1(x CHAR(1)) ENGINE=InnoDB; SELECT ('a%b' LIKE 'a\%b' ESCAPE (SELECT x FROM t1)); ('a%b' LIKE 'a\%b' ESCAPE (SELECT x FROM t1)) 1 SELECT ('a%b' LIKE 'ax%b' ESCAPE (SELECT x FROM t1)); ('a%b' LIKE 'ax%b' ESCAPE (SELECT x FROM t1)) 0 INSERT INTO t1 VALUES ('x'); SELECT ('a%b' LIKE 'a\%b' ESCAPE (SELECT x FROM t1)); ('a%b' LIKE 'a\%b' ESCAPE (SELECT x FROM t1)) 0 SELECT ('a%b' LIKE 'ax%b' ESCAPE (SELECT x FROM t1)); ('a%b' LIKE 'ax%b' ESCAPE (SELECT x FROM t1)) 1 SELECT ('a%b' LIKE 'ax%b' ESCAPE (SELECT 'xy' FROM t1)); ERROR HY000: Incorrect arguments to ESCAPE INSERT INTO t1 VALUES ('y'); SELECT ('a%b' LIKE 'ax%b' ESCAPE (SELECT x FROM t1)); ERROR 21000: Subquery returns more than 1 row DELETE FROM t1 WHERE x = 'y'; SELECT ('a%b' LIKE 'ax%b' ESCAPE (SELECT x, x FROM t1)); ERROR 21000: Operand should contain 1 column(s) SELECT ('a%b' LIKE 'ax%b' ESCAPE ('x', 'y')); ERROR 21000: Operand should contain 1 column(s) SELECT ('a%b' LIKE 'ax%b' ESCAPE x) FROM t1; ERROR HY000: Incorrect arguments to ESCAPE CREATE TABLE t2(x int, y varchar(100)) ENGINE=InnoDB; CREATE INDEX idx ON t2(y); INSERT INTO t2 VALUES (1, 'abcd'), (2, 'ab%cde'); ANALYZE TABLE t2; Table Op Msg_type Msg_text test.t2 analyze status OK EXPLAIN SELECT * FROM t2 WHERE y LIKE 'abc%%' ESCAPE (SELECT 'c' FROM t1) ORDER BY y; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 NULL ALL idx NULL NULL NULL 2 50.00 Using where; Using filesort 2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 1 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`x` AS `x`,`test`.`t2`.`y` AS `y` from `test`.`t2` where (`test`.`t2`.`y` like 'abc%%') order by `test`.`t2`.`y` SELECT * FROM t2 WHERE y LIKE 'abc%%' ESCAPE (SELECT 'c' FROM t1) ORDER BY y; x y 2 ab%cde DROP TABLE t1, t2; # Bug#20035071: Out of range error in subselect lead to assertion failed CREATE TABLE t1(a INTEGER) engine=innodb; SELECT 1 FROM t1 HAVING (SELECT 1 FROM t1) LIKE EXP(NOW()); ERROR 22003: DOUBLE value is out of range in 'exp(now())' DROP TABLE t1;