Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jB0Wq-0006U7-57 for pgsql-hackers@arkaria.postgresql.org; Sun, 08 Mar 2020 18:19:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jB0Wo-0005G3-SY for pgsql-hackers@arkaria.postgresql.org; Sun, 08 Mar 2020 18:19:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jB0Wo-0005Fr-G9 for pgsql-hackers@lists.postgresql.org; Sun, 08 Mar 2020 18:19:54 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jB0Wm-00011r-Ae for pgsql-hackers@lists.postgresql.org; Sun, 08 Mar 2020 18:19:53 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 028IJkcE026488; Sun, 8 Mar 2020 14:19:46 -0400 From: Tom Lane To: James Coleman cc: =?UTF-8?Q?Juan_Jos=C3=A9_Santamar=C3=ADa_Flecha?= , Peter Eisentraut , Mark Dilger , Alvaro Herrera , Arthur Zakirov , Tomas Vondra , PostgreSQL Hackers Subject: Re: Allow to_date() and to_timestamp() to accept localized names In-reply-to: <21675.1583685539@sss.pgh.pa.us> References: <20200124161814.GA8989@alvherre.pgsql> <32487.1579882979@sss.pgh.pa.us> <2f83150e-a2c0-6318-3125-d9b86e421aa2@2ndquadrant.com> <964.1579884408@sss.pgh.pa.us> <7212.1580177517@sss.pgh.pa.us> <2E3D8D71-3B55-4735-A047-1FECE1506CD1@enterprisedb.com> <6642.1580223087@sss.pgh.pa.us> <4144A0A0-4820-458D-A105-D5EC0E0D133B@enterprisedb.com> <16875.1583012185@sss.pgh.pa.us> <6719.1583101530@sss.pgh.pa.us> <29169.1583251740@sss.pgh.pa.us> <16113.1583634677@sss.pgh.pa.us> <16894.1583635679@sss.pgh.pa.us> <21675.1583685539@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sun, 08 Mar 2020 12:38:59 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <26486.1583691586.1@sss.pgh.pa.us> Date: Sun, 08 Mar 2020 14:19:46 -0400 Message-ID: <26487.1583691586@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > James Coleman writes: >> I'm still interested in understanding why we're using the ISO locale >> instead of the utf8 one in a utf8-labeled test though. > We are not. My understanding of the rules about this is that the > active LC_CTYPE setting determines the encoding that libc uses, > period. The encoding suffix on the locale name only makes a > difference when LC_CTYPE is being specified (or derived from LANG or > LC_ALL), not any other LC_XXX setting --- although for consistency > they'll let you include it in any LC_XXX value. Oh wait --- I'm wrong about that. Looking at the code in pg_locale.c, what actually happens is that we get data in the codeset implied by the LC_TIME setting and then translate it to the database encoding (cf commit 7ad1cd31b). So if bare "tr_TR" is taken as implying iso-8859-9, which seems likely (it appears to work that way here, anyway) then this test is exercising the codeset translation path. We could change the test to say 'tr_TR.utf8' but that would give us less test coverage. regards, tom lane