CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET koi8r);
INSERT INTO t1 VALUES ('<27><><EFBFBD><EFBFBD>'),('<27><><EFBFBD><EFBFBD>'),('<27><><EFBFBD><EFBFBD>'),('<27><><EFBFBD><EFBFBD>'),('<27><><EFBFBD><EFBFBD>'),('<27><><EFBFBD><EFBFBD>');
INSERT INTO t1 VALUES ('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'),('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'),('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'),('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
INSERT INTO t1 VALUES ('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'),('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'),('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'),('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
INSERT INTO t1 VALUES ('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'),('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'),('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'),('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
SELECT * FROM t1 WHERE a LIKE '%<25><><EFBFBD><EFBFBD>%';
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'foo!' like 'foo!!' AS `'foo!' like 'foo!!'`,'foo!' like 'foo!!' escape '!' AS `'foo!' like 'foo!!' escape '!'` koi8r koi8r_general_ci
# MDEV-17359 - Extend expression supported by like (| & << >> || + - * / DIV MOD ^ )
#
SELECT 1 LIKE +1;
1 LIKE +1
1
SELECT -1 LIKE -1;
-1 LIKE -1
1
SELECT 1 LIKE (1);
1 LIKE (1)
1
SELECT 1 LIKE 1|2, 3 LIKE 1|2;
1 LIKE 1|2 3 LIKE 1|2
0 1
SELECT 1 LIKE 3&2, 2 LIKE 3&2;
1 LIKE 3&2 2 LIKE 3&2
0 1
SELECT 1 LIKE 1>>0, 1 LIKE 1>>1 , 64 LIKE 256>>2;
1 LIKE 1>>0 1 LIKE 1>>1 64 LIKE 256>>2
1 0 1
SELECT 1 LIKE 1<<0, 1 LIKE 0<<2, 32 LIKE 1<<5;
1 LIKE 1<<0 1 LIKE 0<<2 32 LIKE 1<<5
1 0 1
SELECT 1 LIKE 1||2, 1 LIKE 0||2;
1 LIKE 1||2 1 LIKE 0||2
1 1
SELECT 2 LIKE 1+1, 2.0 LIKE 1+1.0, 2 LIKE 1+1.0, 1+1 LIKE 2, 1+1 LIKE 0+2;
2 LIKE 1+1 2.0 LIKE 1+1.0 2 LIKE 1+1.0 1+1 LIKE 2 1+1 LIKE 0+2
1 1 0 1 1
SELECT 0 LIKE 1-1, 2.0 LIKE 3-1.0, 2 LIKE 3-1.0, 2-1 LIKE 1, 3-1 LIKE 4-1;
0 LIKE 1-1 2.0 LIKE 3-1.0 2 LIKE 3-1.0 2-1 LIKE 1 3-1 LIKE 4-1
1 1 0 1 0
SELECT 1 LIKE 1*1, 2.0 LIKE 2*1.0, 2 LIKE 2*1.0, 2*1 LIKE 2, 2*3 LIKE 6*1;
1 LIKE 1*1 2.0 LIKE 2*1.0 2 LIKE 2*1.0 2*1 LIKE 2 2*3 LIKE 6*1
1 1 0 1 1
SELECT 1 LIKE 1/1, 1.0000 LIKE 1/1, 1.0000 LIKE 1/1.000000, 1.000000 LIKE 1.0/1.000000, 1/1 like 1/1;
1 LIKE 1/1 1.0000 LIKE 1/1 1.0000 LIKE 1/1.000000 1.000000 LIKE 1.0/1.000000 1/1 like 1/1
0 1 1 0 1
SELECT 1 LIKE 1 DIV 1, 1 LIKE 1.0 DIV 1.0 ;
1 LIKE 1 DIV 1 1 LIKE 1.0 DIV 1.0
1 1
SELECT 2 LIKE 10 MOD 8, 1.9 LIKE 10 MOD 8.1, 1.9 LIKE 10 MOD 8.10 ;
2 LIKE 10 MOD 8 1.9 LIKE 10 MOD 8.1 1.9 LIKE 10 MOD 8.10
1 1 0
SELECT 1 LIKE CAST(1 AS CHAR(10));
1 LIKE CAST(1 AS CHAR(10))
1
SELECT 1 LIKE CASE WHEN 1=1 THEN '1' ELSE '0' END;
1 LIKE CASE WHEN 1=1 THEN '1' ELSE '0' END
1
SELECT 1 LIKE COALESCE(1+0, 1);
1 LIKE COALESCE(1+0, 1)
1
CREATE TABLE t1(c1 INTEGER, c2 INTEGER);
INSERT INTO t1 VALUES(1,1);
INSERT INTO t1 VALUES(1,2);
SELECT c1, c2, c1|c2, 1 LIKE c1|c2 FROM t1 ORDER BY c2;
c1 c2 c1|c2 1 LIKE c1|c2
1 1 1 1
1 2 3 0
SELECT c1, c2, c1&c2, 1 LIKE c1&c2 FROM t1 ORDER BY c2;
c1 c2 c1&c2 1 LIKE c1&c2
1 1 1 1
1 2 0 0
SELECT c1, c2, c2>>c1, 1 LIKE c2>>c1 FROM t1 ORDER BY c2;
c1 c2 c2>>c1 1 LIKE c2>>c1
1 1 0 0
1 2 1 1
SELECT c1, c2, c2<<c1, 2 LIKE c2<<c1 FROM t1 ORDER BY c2;
c1 c2 c2<<c1 2 LIKE c2<<c1
1 1 2 1
1 2 4 0
SELECT c1, c2, c1||c2, 1 LIKE c1||c2 FROM t1 ORDER BY c2;
c1 c2 c1||c2 1 LIKE c1||c2
1 1 1 1
1 2 1 1
SELECT c1, c2, c1+c2, 2 LIKE c1+c2 FROM t1 ORDER BY c2;
c1 c2 c1+c2 2 LIKE c1+c2
1 1 2 1
1 2 3 0
SELECT c1, c2, c1-c2, -1 LIKE c1-c2 FROM t1 ORDER BY c2;
c1 c2 c1-c2 -1 LIKE c1-c2
1 1 0 0
1 2 -1 1
SELECT c1, c2, c1*c2, 2 LIKE c1*c2 FROM t1 ORDER BY c2;
c1 c2 c1*c2 2 LIKE c1*c2
1 1 1 0
1 2 2 1
SELECT c1, c2, c1/c2, 0.5000 LIKE c1/c2 FROM t1 ORDER BY c2;
c1 c2 c1/c2 0.5000 LIKE c1/c2
1 1 1.0000 0
1 2 0.5000 1
SELECT c1, c2, c1 DIV c2, 0 LIKE c1 DIV c2 FROM t1 ORDER BY c2;
c1 c2 c1 DIV c2 0 LIKE c1 DIV c2
1 1 1 0
1 2 0 1
SELECT c1, c2, c1 MOD c2, 0 LIKE c1 MOD c2 FROM t1 ORDER BY c2;
c1 c2 c1 MOD c2 0 LIKE c1 MOD c2
1 1 0 1
1 2 1 0
CREATE VIEW v1 AS
SELECT 1 LIKE c1|c2, 1 LIKE c1&c2, 1 LIKE c2>>c1, 2 LIKE c2<<c1,
1 LIKE c1||c2, 2 LIKE c1+c2, -1 LIKE c1-c2, 2 LIKE c1*c2,
0.5000 LIKE c1/c2, 0 LIKE c1 DIV c2, 0 LIKE c1 MOD c2
FROM t1 ORDER BY c2;
SELECT * FROM v1;
1 LIKE c1|c2 1 LIKE c1&c2 1 LIKE c2>>c1 2 LIKE c2<<c1 1 LIKE c1||c2 2 LIKE c1+c2 -1 LIKE c1-c2 2 LIKE c1*c2 0.5000 LIKE c1/c2 0 LIKE c1 DIV c2 0 LIKE c1 MOD c2
1 1 0 1 1 1 0 0 0 0 1
0 0 1 0 1 0 1 1 1 1 0
EXPLAIN EXTENDED SELECT * FROM v1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using filesort
Warnings:
Note 1003 select 1 like `test`.`t1`.`c1` | `test`.`t1`.`c2` AS `1 LIKE c1|c2`,1 like `test`.`t1`.`c1` & `test`.`t1`.`c2` AS `1 LIKE c1&c2`,1 like `test`.`t1`.`c2` >> `test`.`t1`.`c1` AS `1 LIKE c2>>c1`,2 like `test`.`t1`.`c2` << `test`.`t1`.`c1` AS `2 LIKE c2<<c1`,1 like `test`.`t1`.`c1` or `test`.`t1`.`c2` <> 0 AS `1 LIKE c1||c2`,2 like `test`.`t1`.`c1` + `test`.`t1`.`c2` AS `2 LIKE c1+c2`,-1 like `test`.`t1`.`c1` - `test`.`t1`.`c2` AS `-1 LIKE c1-c2`,2 like `test`.`t1`.`c1` * `test`.`t1`.`c2` AS `2 LIKE c1*c2`,0.5000 like `test`.`t1`.`c1` / `test`.`t1`.`c2` AS `0.5000 LIKE c1/c2`,0 like `test`.`t1`.`c1` DIV `test`.`t1`.`c2` AS `0 LIKE c1 DIV c2`,0 like `test`.`t1`.`c1` MOD `test`.`t1`.`c2` AS `0 LIKE c1 MOD c2` from `test`.`t1` order by `test`.`t1`.`c2`