summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-05-28 17:35:23 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2010-05-28 17:35:23 +0000
commitdbde97cdde4afbd0a175880446e301f1bfb8994c (patch)
tree970af6c95b742d1e7efe063a4280ca5375095462 /src/test
parente54b0cba96683ae9a33458a9cbd5ea53c479754d (diff)
Rewrite LIKE's %-followed-by-_ optimization so it really works (this time
for sure ;-)). It now also optimizes more cases, such as %_%_. Improve comments too. Per bug #5478. In passing, also rename the TCHAR macro to GETCHAR, because pgindent is messing with the formatting of the former (apparently it now thinks TCHAR is a typedef name). Back-patch to 8.3, where the bug was introduced.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/strings.out8
-rw-r--r--src/test/regress/sql/strings.sql4
2 files changed, 10 insertions, 2 deletions
diff --git a/src/test/regress/expected/strings.out b/src/test/regress/expected/strings.out
index 42c34a55228..1bd6772ddd4 100644
--- a/src/test/regress/expected/strings.out
+++ b/src/test/regress/expected/strings.out
@@ -996,7 +996,7 @@ SELECT 'Hawkeye' NOT ILIKE 'h%' AS "false";
(1 row)
--
--- test %/_ combination cases, cf bug #4821
+-- test %/_ combination cases, cf bugs #4821 and #5478
--
SELECT 'foo' LIKE '_%' as t, 'f' LIKE '_%' as t, '' LIKE '_%' as f;
t | t | f
@@ -1022,6 +1022,12 @@ SELECT 'foo' LIKE '%__' as t, 'foo' LIKE '%___' as t, 'foo' LIKE '%____' as f;
t | t | f
(1 row)
+SELECT 'jack' LIKE '%____%' AS t;
+ t
+---
+ t
+(1 row)
+
--
-- test implicit type conversion
--
diff --git a/src/test/regress/sql/strings.sql b/src/test/regress/sql/strings.sql
index 8c35be81360..6ef446308b5 100644
--- a/src/test/regress/sql/strings.sql
+++ b/src/test/regress/sql/strings.sql
@@ -301,7 +301,7 @@ SELECT 'Hawkeye' ILIKE 'h%' AS "true";
SELECT 'Hawkeye' NOT ILIKE 'h%' AS "false";
--
--- test %/_ combination cases, cf bug #4821
+-- test %/_ combination cases, cf bugs #4821 and #5478
--
SELECT 'foo' LIKE '_%' as t, 'f' LIKE '_%' as t, '' LIKE '_%' as f;
@@ -310,6 +310,8 @@ SELECT 'foo' LIKE '%_' as t, 'f' LIKE '%_' as t, '' LIKE '%_' as f;
SELECT 'foo' LIKE '__%' as t, 'foo' LIKE '___%' as t, 'foo' LIKE '____%' as f;
SELECT 'foo' LIKE '%__' as t, 'foo' LIKE '%___' as t, 'foo' LIKE '%____' as f;
+SELECT 'jack' LIKE '%____%' AS t;
+
--
-- test implicit type conversion