mirror of
https://github.com/postgres/postgres.git
synced 2026-07-08 01:01:01 -04:00
Fix unintentional behavior change from 5a38104b36.
Reported-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/20260630012919.78@rfd.leadboat.com Backpatch-through: 19
This commit is contained in:
parent
93338a0fd3
commit
ef5d080b45
3 changed files with 14 additions and 2 deletions
|
|
@ -191,12 +191,14 @@ Generic_Text_IC_like(text *str, text *pat, Oid collation)
|
|||
|
||||
/*
|
||||
* For efficiency reasons, in the C locale we don't call lower() on the
|
||||
* pattern and text, but instead lowercase each character lazily.
|
||||
* pattern and text, but instead lowercase each character lazily. This
|
||||
* only works for single-byte encodings, otherwise "_" may incorrectly
|
||||
* match an incomplete byte sequence.
|
||||
*
|
||||
* XXX: use casefolding instead?
|
||||
*/
|
||||
|
||||
if (locale->ctype_is_c)
|
||||
if (locale->ctype_is_c && pg_database_encoding_max_length() == 1)
|
||||
{
|
||||
p = VARDATA_ANY(pat);
|
||||
plen = VARSIZE_ANY_EXHDR(pat);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,13 @@ SELECT U&'\00C1\00E1' !~ '[[:alpha:]]' COLLATE regress_builtin_c;
|
|||
(1 row)
|
||||
|
||||
DROP COLLATION regress_builtin_c;
|
||||
-- a '_' matches a multibyte character
|
||||
SELECT 'café' ILIKE 'caf_' COLLATE "C";
|
||||
?column?
|
||||
----------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
--
|
||||
-- Test PG_C_UTF8
|
||||
--
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ SELECT U&'\00C1\00E1' !~ '[[:alpha:]]' COLLATE regress_builtin_c;
|
|||
|
||||
DROP COLLATION regress_builtin_c;
|
||||
|
||||
-- a '_' matches a multibyte character
|
||||
SELECT 'café' ILIKE 'caf_' COLLATE "C";
|
||||
|
||||
--
|
||||
-- Test PG_C_UTF8
|
||||
--
|
||||
|
|
|
|||
Loading…
Reference in a new issue