mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-17359 Concatenation operator || in like expression
This commit is contained in:
committed by
Alexander Barkov
parent
981a81090f
commit
67f06cadc3
@ -322,3 +322,72 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select concat_operator_oracle(-1,0 ^ 1) AS "a"
|
||||
#
|
||||
# MDEV-17359 Concatenation operator || in like expression failed in sql_mode=ORACLE
|
||||
#
|
||||
SELECT 'abc' LIKE 'a'||'%';
|
||||
'abc' LIKE 'a'||'%'
|
||||
1
|
||||
EXPLAIN EXTENDED SELECT 'abc' LIKE 'a'||'%';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select 'abc' like concat_operator_oracle('a','%') AS "'abc' LIKE 'a'||'%'"
|
||||
SELECT 'x' FROM DUAL WHERE 11 LIKE 1||1;
|
||||
x
|
||||
x
|
||||
SELECT 'x' FROM DUAL WHERE 1||1 LIKE 11;
|
||||
x
|
||||
x
|
||||
SELECT 'x' FROM DUAL WHERE 1||1 LIKE 1||1;
|
||||
x
|
||||
x
|
||||
CREATE TABLE t1 (c1 VARCHAR(10),c2 VARCHAR(10), ord INTEGER);
|
||||
INSERT INTO t1 VALUES ('a', 'ab' ,1);
|
||||
INSERT INTO t1 VALUES ('ab', 'ab', 2);
|
||||
INSERT INTO t1 VALUES ('abc', 'ab', 3);
|
||||
SELECT c1 FROM t1 WHERE c1 LIKE '%'||'b' ORDER BY ord;
|
||||
c1
|
||||
ab
|
||||
EXPLAIN EXTENDED SELECT c1 FROM t1 WHERE c1 LIKE '%'||'b' ORDER BY ord;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select "test"."t1"."c1" AS "c1" from "test"."t1" where "test"."t1"."c1" like <cache>(concat_operator_oracle('%','b')) order by "test"."t1"."ord"
|
||||
SELECT c1 FROM t1 WHERE c1 LIKE c2||'%'||'c' ORDER BY ord;
|
||||
c1
|
||||
abc
|
||||
EXPLAIN EXTENDED SELECT c1 FROM t1 WHERE c1 LIKE c2||'%'||'c' ORDER BY ord;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select "test"."t1"."c1" AS "c1" from "test"."t1" where "test"."t1"."c1" like concat_operator_oracle(concat_operator_oracle("test"."t1"."c2",'%'),'c') order by "test"."t1"."ord"
|
||||
SELECT 'x' FROM t1 WHERE c1||c2 LIKE 'aa%';
|
||||
x
|
||||
x
|
||||
EXPLAIN EXTENDED SELECT 'x' FROM t1 WHERE c1||c2 LIKE 'aa%';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select 'x' AS "x" from "test"."t1" where concat_operator_oracle("test"."t1"."c1","test"."t1"."c2") like 'aa%'
|
||||
SELECT 'x' FROM t1 WHERE c1||c2 LIKE c2||c1;
|
||||
x
|
||||
x
|
||||
EXPLAIN EXTENDED SELECT 'x' FROM t1 WHERE c1||c2 LIKE c2||c1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select 'x' AS "x" from "test"."t1" where concat_operator_oracle("test"."t1"."c1","test"."t1"."c2") like concat_operator_oracle("test"."t1"."c2","test"."t1"."c1")
|
||||
CREATE VIEW v1 AS SELECT c1, c2, c1 LIKE c2||'_' FROM t1 ORDER BY ord;
|
||||
SELECT * FROM v1;
|
||||
c1 c2 c1 LIKE c2||'_'
|
||||
a ab 0
|
||||
ab ab 0
|
||||
abc ab 1
|
||||
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 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select "test"."t1"."c1" AS "c1","test"."t1"."c2" AS "c2","test"."t1"."c1" like concat_operator_oracle("test"."t1"."c2",'_') AS "c1 LIKE c2||'_'" from "test"."t1" order by "test"."t1"."ord"
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
Reference in New Issue
Block a user