Skip to content

Commit eb42110

Browse files
committed
Add tests for bytea LIKE operator
Add test coverage for the following operations, which were previously not tested at all: bytea LIKE bytea (bytealike) bytea NOT LIKE bytea (byteanlike) ESCAPE clause for the above (like_escape_bytea) also name NOT ILIKE text (nameicnlike) Discussion: https://www.postgresql.org/message-id/flat/4d13563a-2c8d-fd91-20d5-e71b7a4eaa87%40enterprisedb.com
1 parent f5465fa commit eb42110

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

src/test/regress/expected/strings.out

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,30 @@ SELECT 'indio' NOT LIKE 'in_o' AS "true";
10351035
t
10361036
(1 row)
10371037

1038+
SELECT 'abc'::name LIKE '_b_' AS "true";
1039+
true
1040+
------
1041+
t
1042+
(1 row)
1043+
1044+
SELECT 'abc'::name NOT LIKE '_b_' AS "false";
1045+
false
1046+
-------
1047+
f
1048+
(1 row)
1049+
1050+
SELECT 'abc'::bytea LIKE '_b_'::bytea AS "true";
1051+
true
1052+
------
1053+
t
1054+
(1 row)
1055+
1056+
SELECT 'abc'::bytea NOT LIKE '_b_'::bytea AS "false";
1057+
false
1058+
-------
1059+
f
1060+
(1 row)
1061+
10381062
-- unused escape character
10391063
SELECT 'hawkeye' LIKE 'h%' ESCAPE '#' AS "true";
10401064
true
@@ -1158,6 +1182,18 @@ SELECT 'i_dio' NOT LIKE 'i$_d%o' ESCAPE '$' AS "false";
11581182
f
11591183
(1 row)
11601184

1185+
SELECT 'a_c'::bytea LIKE 'a$__'::bytea ESCAPE '$'::bytea AS "true";
1186+
true
1187+
------
1188+
t
1189+
(1 row)
1190+
1191+
SELECT 'a_c'::bytea NOT LIKE 'a$__'::bytea ESCAPE '$'::bytea AS "false";
1192+
false
1193+
-------
1194+
f
1195+
(1 row)
1196+
11611197
-- escape character same as pattern character
11621198
SELECT 'maca' LIKE 'm%aca' ESCAPE '%' AS "true";
11631199
true
@@ -1271,6 +1307,18 @@ SELECT 'Hawkeye' NOT ILIKE 'h%' AS "false";
12711307
f
12721308
(1 row)
12731309

1310+
SELECT 'ABC'::name ILIKE '_b_' AS "true";
1311+
true
1312+
------
1313+
t
1314+
(1 row)
1315+
1316+
SELECT 'ABC'::name NOT ILIKE '_b_' AS "false";
1317+
false
1318+
-------
1319+
f
1320+
(1 row)
1321+
12741322
--
12751323
-- test %/_ combination cases, cf bugs #4821 and #5478
12761324
--

src/test/regress/sql/strings.sql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,12 @@ SELECT 'indio' NOT LIKE 'in__o' AS "false";
300300
SELECT 'indio' LIKE 'in_o' AS "false";
301301
SELECT 'indio' NOT LIKE 'in_o' AS "true";
302302

303+
SELECT 'abc'::name LIKE '_b_' AS "true";
304+
SELECT 'abc'::name NOT LIKE '_b_' AS "false";
305+
306+
SELECT 'abc'::bytea LIKE '_b_'::bytea AS "true";
307+
SELECT 'abc'::bytea NOT LIKE '_b_'::bytea AS "false";
308+
303309
-- unused escape character
304310
SELECT 'hawkeye' LIKE 'h%' ESCAPE '#' AS "true";
305311
SELECT 'hawkeye' NOT LIKE 'h%' ESCAPE '#' AS "false";
@@ -333,6 +339,9 @@ SELECT 'i_dio' NOT LIKE 'i$_nd_o' ESCAPE '$' AS "true";
333339
SELECT 'i_dio' LIKE 'i$_d%o' ESCAPE '$' AS "true";
334340
SELECT 'i_dio' NOT LIKE 'i$_d%o' ESCAPE '$' AS "false";
335341

342+
SELECT 'a_c'::bytea LIKE 'a$__'::bytea ESCAPE '$'::bytea AS "true";
343+
SELECT 'a_c'::bytea NOT LIKE 'a$__'::bytea ESCAPE '$'::bytea AS "false";
344+
336345
-- escape character same as pattern character
337346
SELECT 'maca' LIKE 'm%aca' ESCAPE '%' AS "true";
338347
SELECT 'maca' NOT LIKE 'm%aca' ESCAPE '%' AS "false";
@@ -367,6 +376,9 @@ SELECT 'hawkeye' NOT ILIKE 'H%Eye' AS "false";
367376
SELECT 'Hawkeye' ILIKE 'h%' AS "true";
368377
SELECT 'Hawkeye' NOT ILIKE 'h%' AS "false";
369378

379+
SELECT 'ABC'::name ILIKE '_b_' AS "true";
380+
SELECT 'ABC'::name NOT ILIKE '_b_' AS "false";
381+
370382
--
371383
-- test %/_ combination cases, cf bugs #4821 and #5478
372384
--

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy