22DROP TABLE IF EXISTS t_like_escape;
33-- result:
44-- !result
5-
65CREATE TABLE IF NOT EXISTS t_like_escape (
76 c0 INT NOT NULL,
87 c1 VARCHAR(200) NOT NULL
@@ -12,7 +11,6 @@ DISTRIBUTED BY HASH(c0) BUCKETS 1
1211PROPERTIES ("replication_num" = "1");
1312-- result:
1413-- !result
15-
1614INSERT INTO t_like_escape (c0, c1) VALUES
1715(1, 'abc'),
1816(2, 'abc\\def'),
@@ -25,7 +23,6 @@ INSERT INTO t_like_escape (c0, c1) VALUES
2523(9, 'abc_def');
2624-- result:
2725-- !result
28-
2926SELECT c0, c1 FROM t_like_escape WHERE c1 LIKE '%\\\\%' ORDER BY c0;
3027-- result:
31282 abc\def
@@ -34,29 +31,24 @@ SELECT c0, c1 FROM t_like_escape WHERE c1 LIKE '%\\\\%' ORDER BY c0;
34317 test\asdf
35328 star\test
3633-- !result
37-
3834SELECT c0, c1 FROM t_like_escape WHERE c1 LIKE '%\\\\asdf' ORDER BY c0;
3935-- result:
40366 \asdf
41377 test\asdf
4238-- !result
43-
4439SELECT c0, c1 FROM t_like_escape WHERE c1 LIKE 'star\\\\%' ORDER BY c0;
4540-- result:
46413 star\
47428 star\test
4843-- !result
49-
5044SELECT c0, c1 FROM t_like_escape WHERE c1 LIKE 'star\\\\' ORDER BY c0;
5145-- result:
52463 star\
5347-- !result
54-
5548SELECT c0, c1 FROM t_like_escape WHERE c1 LIKE 'star\\%' ORDER BY c0;
5649-- result:
57504 star%
5851-- !result
59-
6052SELECT c0, c1 FROM t_like_escape WHERE like(c1, '%\\\\%') ORDER BY c0;
6153-- result:
62542 abc\def
@@ -65,12 +57,10 @@ SELECT c0, c1 FROM t_like_escape WHERE like(c1, '%\\\\%') ORDER BY c0;
65577 test\asdf
66588 star\test
6759-- !result
68-
6960SELECT c0, c1 FROM t_like_escape WHERE like(c1, 'star\\\\') ORDER BY c0;
7061-- result:
71623 star\
7263-- !result
73-
7464SELECT c0, c1 FROM t_like_escape WHERE c1 LIKE '%\\\\%' OR c1 LIKE 'star%' ORDER BY c0;
7565-- result:
76662 abc\def
@@ -81,12 +71,74 @@ SELECT c0, c1 FROM t_like_escape WHERE c1 LIKE '%\\\\%' OR c1 LIKE 'star%' ORDER
81717 test\asdf
82728 star\test
8373-- !result
84-
8574SELECT c0, c1 FROM t_like_escape WHERE c1 LIKE 'abc\\_def' ORDER BY c0;
8675-- result:
87769 abc_def
8877-- !result
89-
9078DROP TABLE t_like_escape;
9179-- result:
9280-- !result
81+ SELECT 'a\\b' LIKE 'a\\\\b';
82+ -- result:
83+ 1
84+ -- !result
85+ SELECT 'a\\b' LIKE 'a\\b';
86+ -- result:
87+ 0
88+ -- !result
89+ SELECT '100%' LIKE '100\\%';
90+ -- result:
91+ 1
92+ -- !result
93+ SELECT '100abc' LIKE '100\\%';
94+ -- result:
95+ 0
96+ -- !result
97+ SELECT 'a_b' LIKE 'a\\_b';
98+ -- result:
99+ 1
100+ -- !result
101+ SELECT 'aXb' LIKE 'a\\_b';
102+ -- result:
103+ 0
104+ -- !result
105+ SELECT 'abc%xyz' LIKE 'abc\\%%';
106+ -- result:
107+ 1
108+ -- !result
109+ SELECT 'abcXyz' LIKE 'abc\\%%';
110+ -- result:
111+ 0
112+ -- !result
113+ SELECT 'xyz%abc' LIKE '%\\%abc';
114+ -- result:
115+ 1
116+ -- !result
117+ SELECT 'xa%by' LIKE '%a\\%b%';
118+ -- result:
119+ 1
120+ -- !result
121+ SELECT 'xaXby' LIKE '%a\\%b%';
122+ -- result:
123+ 0
124+ -- !result
125+ SELECT 'a\\xyz' LIKE 'a\\\\%';
126+ -- result:
127+ 1
128+ -- !result
129+ SELECT 'abc\\' LIKE 'abc\\\\';
130+ -- result:
131+ 1
132+ -- !result
133+ SELECT 'abcdef' LIKE 'abc%';
134+ -- result:
135+ 1
136+ -- !result
137+ SELECT 'xyzabc' LIKE '%abc';
138+ -- result:
139+ 1
140+ -- !result
141+ SELECT 'xyzabcdef' LIKE '%abc%';
142+ -- result:
143+ 1
144+ -- !result
0 commit comments