pgsql: Fix to_char() to use ASCII-only case-folding rules where appropr

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix to_char() to use ASCII-only case-folding rules where appropr
Date: 2013-03-05 18:03:16
Message-ID: E1UCwCq-0001U8-CC@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix to_char() to use ASCII-only case-folding rules where appropriate.

formatting.c used locale-dependent case folding rules in some code paths
where the result isn't supposed to be locale-dependent, for example
to_char(timestamp, 'DAY'). Since the source data is always just ASCII
in these cases, that usually didn't matter ... but it does matter in
Turkish locales, which have unusual treatment of "i" and "I". To confuse
matters even more, the misbehavior was only visible in UTF8 encoding,
because in single-byte encodings we used pg_toupper/pg_tolower which
don't have locale-specific behavior for ASCII characters. Fix by providing
intentionally ASCII-only case-folding functions and using these where
appropriate. Per bug #7913 from Adnan Dursun. Back-patch to all active
branches, since it's been like this for a long time.

Branch
------
REL9_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/1db236c74a2bc21178e4275bba7329d5cf3aaf55

Modified Files
--------------
src/backend/utils/adt/formatting.c | 170 ++++++++++++++++++++++++-----------
src/include/utils/formatting.h | 4 +
2 files changed, 120 insertions(+), 54 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Josh Berkus 2013-03-05 20:03:56 Re: Materialized views WIP patch
Previous Message Simon Riggs 2013-03-05 14:44:38 Re: Materialized views WIP patch