Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UCB45-0005m3-0U for pgsql-bugs@arkaria.postgresql.org; Sun, 03 Mar 2013 15:43:05 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UCB44-000570-Gh for pgsql-bugs@arkaria.postgresql.org; Sun, 03 Mar 2013 15:43:04 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UCB43-00056v-Un for pgsql-bugs@postgresql.org; Sun, 03 Mar 2013 15:43:04 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UCB42-0002Hw-Ak for pgsql-bugs@postgresql.org; Sun, 03 Mar 2013 15:43:03 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id r23FgxjU016009; Sun, 3 Mar 2013 10:43:00 -0500 (EST) From: Tom Lane To: a_dursun@hotmail.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #7913: TO_CHAR Function & Turkish collate In-reply-to: References: Comments: In-reply-to a_dursun@hotmail.com message dated "Sat, 02 Mar 2013 12:46:14 +0000" Date: Sun, 03 Mar 2013 10:42:59 -0500 Message-ID: <16008.1362325379@sss.pgh.pa.us> X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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