pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: a_dursun@hotmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7913: TO_CHAR Function & Turkish collate
Date: Sun, 03 Mar 2013 10:42:59 -0500
Message-ID: <16008.1362325379@sss.pgh.pa.us> (raw)
In-Reply-To: <E1UBlpO-0007X0-NU@wrigleys.postgresql.org>
References: <E1UBlpO-0007X0-NU@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

a_dursun@hotmail.com writes:
> prod=# SELECT TO_CHAR('2013-03-01'::date,'DAY');
>  to_char
> ----------
>  FRİDAY
> (1 row)
> But it must return as FRIDAY.
> Our database lc_collate is tr_TR.UTF-8 and encoding is UTF8.

It looks like the cause of this is that the result is computed as
str_toupper("Friday"), and str_toupper() applies a collation-sensitive
upcasing rule.

I think the use of str_toupper() is appropriate when processing the
locale-specific string for a TMDAY specification; but plain DAY is not
supposed to be locale-dependent, so we probably should use an ASCII-only
upcasing rule in the non-TM code path.

Anybody have an opinion on whether to back-patch such a fix?  It seems
conceivable that somebody out there is relying on the current behavior.
OTOH, I believe that only Turkish UTF8 locales exhibit this behavior
(the single-byte-encoding code path in str_toupper acts differently for
historical reasons).  So it's pretty inconsistent as it stands.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (7+ messages)  latest in thread

Message-ID: <16008.1362325379@sss.pgh.pa.us>
Permalink:  ../16008.1362325379@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/16008.1362325379@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, a_dursun@hotmail.com
  Subject: Re: BUG #7913: TO_CHAR Function & Turkish collate
  In-Reply-To: <16008.1362325379@sss.pgh.pa.us>
  References: <E1UBlpO-0007X0-NU@wrigleys.postgresql.org> <16008.1362325379@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox