mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Fix LIKE's special-case code for % followed by _. I'm not entirely sure that
this case is worth a special code path, but a special code path that gets the boundary condition wrong is definitely no good. Per bug #4821 from Andrew Gierth. In passing, clean up some minor code formatting issues (excess parentheses and blank lines in odd places). Back-patch to 8.3, where the bug was introduced.
This commit is contained in:
@@ -279,6 +279,17 @@ SELECT 'hawkeye' NOT ILIKE 'H%Eye' AS "false";
|
||||
SELECT 'Hawkeye' ILIKE 'h%' AS "true";
|
||||
SELECT 'Hawkeye' NOT ILIKE 'h%' AS "false";
|
||||
|
||||
--
|
||||
-- test %/_ combination cases, cf bug #4821
|
||||
--
|
||||
|
||||
SELECT 'foo' LIKE '_%' as t, 'f' LIKE '_%' as t, '' LIKE '_%' as f;
|
||||
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;
|
||||
|
||||
|
||||
--
|
||||
-- test implicit type conversion
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user