mirror of
https://github.com/postgres/postgres.git
synced 2025-12-19 17:02:53 +03:00
Fix INITCAP() word boundaries for PG_UNICODE_FAST.
Word boundaries are based on whether a character is alphanumeric or not. For the PG_UNICODE_FAST collation, alphanumeric includes non-ASCII digits; whereas for the PG_C_UTF8 collation, it only includes digits 0-9. Pass down the right information from the pg_locale_t into initcap_wbnext to differentiate the behavior. Reported-by: Noah Misch <noah@leadboat.com> Reviewed-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/20250417135841.33.nmisch@google.com
This commit is contained in:
@@ -52,6 +52,7 @@ INSERT INTO test_pg_c_utf8 VALUES
|
||||
('abc DEF 123abc'),
|
||||
('ábc sßs ßss DÉF'),
|
||||
('DŽxxDŽ džxxDž Džxxdž'),
|
||||
(U&'Λλ 1a \FF11a'),
|
||||
('ȺȺȺ'),
|
||||
('ⱥⱥⱥ'),
|
||||
('ⱥȺ');
|
||||
@@ -67,10 +68,11 @@ SELECT
|
||||
abc DEF 123abc | abc def 123abc | Abc Def 123abc | ABC DEF 123ABC | 14 | 14 | 14 | 14
|
||||
ábc sßs ßss DÉF | ábc sßs ßss déf | Ábc Sßs ßss Déf | ÁBC SßS ßSS DÉF | 19 | 19 | 19 | 19
|
||||
DŽxxDŽ džxxDž Džxxdž | džxxdž džxxdž džxxdž | DŽxxdž DŽxxdž DŽxxdž | DŽXXDŽ DŽXXDŽ DŽXXDŽ | 20 | 20 | 20 | 20
|
||||
Λλ 1a 1a | λλ 1a 1a | Λλ 1a 1A | ΛΛ 1A 1A | 12 | 12 | 12 | 12
|
||||
ȺȺȺ | ⱥⱥⱥ | Ⱥⱥⱥ | ȺȺȺ | 6 | 9 | 8 | 6
|
||||
ⱥⱥⱥ | ⱥⱥⱥ | Ⱥⱥⱥ | ȺȺȺ | 9 | 9 | 8 | 6
|
||||
ⱥȺ | ⱥⱥ | Ⱥⱥ | ȺȺ | 5 | 6 | 5 | 4
|
||||
(6 rows)
|
||||
(7 rows)
|
||||
|
||||
DROP TABLE test_pg_c_utf8;
|
||||
-- negative test: Final_Sigma not used for builtin locale C.UTF-8
|
||||
@@ -182,6 +184,7 @@ INSERT INTO test_pg_unicode_fast VALUES
|
||||
('abc DEF 123abc'),
|
||||
('ábc sßs ßss DÉF'),
|
||||
('DŽxxDŽ džxxDž Džxxdž'),
|
||||
(U&'Λλ 1a \FF11a'),
|
||||
('ȺȺȺ'),
|
||||
('ⱥⱥⱥ'),
|
||||
('ⱥȺ');
|
||||
@@ -197,10 +200,11 @@ SELECT
|
||||
abc DEF 123abc | abc def 123abc | Abc Def 123abc | ABC DEF 123ABC | 14 | 14 | 14 | 14
|
||||
ábc sßs ßss DÉF | ábc sßs ßss déf | Ábc Sßs Ssss Déf | ÁBC SSSS SSSS DÉF | 19 | 19 | 19 | 19
|
||||
DŽxxDŽ džxxDž Džxxdž | džxxdž džxxdž džxxdž | Džxxdž Džxxdž Džxxdž | DŽXXDŽ DŽXXDŽ DŽXXDŽ | 20 | 20 | 20 | 20
|
||||
Λλ 1a 1a | λλ 1a 1a | Λλ 1a 1a | ΛΛ 1A 1A | 12 | 12 | 12 | 12
|
||||
ȺȺȺ | ⱥⱥⱥ | Ⱥⱥⱥ | ȺȺȺ | 6 | 9 | 8 | 6
|
||||
ⱥⱥⱥ | ⱥⱥⱥ | Ⱥⱥⱥ | ȺȺȺ | 9 | 9 | 8 | 6
|
||||
ⱥȺ | ⱥⱥ | Ⱥⱥ | ȺȺ | 5 | 6 | 5 | 4
|
||||
(6 rows)
|
||||
(7 rows)
|
||||
|
||||
DROP TABLE test_pg_unicode_fast;
|
||||
-- test Final_Sigma
|
||||
|
||||
@@ -45,6 +45,7 @@ INSERT INTO test_pg_c_utf8 VALUES
|
||||
('abc DEF 123abc'),
|
||||
('ábc sßs ßss DÉF'),
|
||||
('DŽxxDŽ džxxDž Džxxdž'),
|
||||
(U&'Λλ 1a \FF11a'),
|
||||
('ȺȺȺ'),
|
||||
('ⱥⱥⱥ'),
|
||||
('ⱥȺ');
|
||||
@@ -100,6 +101,7 @@ INSERT INTO test_pg_unicode_fast VALUES
|
||||
('abc DEF 123abc'),
|
||||
('ábc sßs ßss DÉF'),
|
||||
('DŽxxDŽ džxxDž Džxxdž'),
|
||||
(U&'Λλ 1a \FF11a'),
|
||||
('ȺȺȺ'),
|
||||
('ⱥⱥⱥ'),
|
||||
('ⱥȺ');
|
||||
|
||||
Reference in New Issue
Block a user