Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bikQb-0003u0-2E for pgsql-hackers@arkaria.postgresql.org; Sat, 10 Sep 2016 15:42:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bikQa-00064N-GG for pgsql-hackers@arkaria.postgresql.org; Sat, 10 Sep 2016 15:42:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bikPE-0004VQ-1e for pgsql-hackers@postgresql.org; Sat, 10 Sep 2016 15:41:24 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bikPB-0005FY-3p for pgsql-hackers@postgresql.org; Sat, 10 Sep 2016 15:41:23 +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 u8AFfIFO019810; Sat, 10 Sep 2016 11:41:18 -0400 From: Tom Lane To: Mattia cc: PostgreSQL mailing lists Subject: Re: Allow to_date() and to_timestamp() to accept localized month names In-reply-to: References: Comments: In-reply-to Mattia message dated "Sat, 10 Sep 2016 12:18:04 +0200" Date: Sat, 10 Sep 2016 11:41:18 -0400 Message-ID: <19809.1473522078@sss.pgh.pa.us> X-Pg-Spam-Score: -3.2 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Mattia writes: > attached is a patch which adds support to localized month names in > to_date() and to_timestamp() functions. Seems like a fine goal. > I thought about reusing from_char_seq_search() but localized month > names use different capitalization according to the language grammar, > so I used pg_strncasecmp to do the match. pg_str(n)casecmp is really only meant to handle comparisons of ASCII strings; it will definitely not succeed in case-folding multibyte characters. That's not a big problem for to_date's existing usages but I'm afraid it will be for non-English month names. I think you'll need another solution there. You might have to resort to what citext does, namely apply the full lower() transformation, at least whenever the data string actually contains MB characters. > Regression tests with TM modifier are difficult since one should have > the locale used for the test installed on his system. I suspect you'll have to give up on putting much about this into the standard regression tests. We've used not-run-by-default test scripts in some similar cases (eg collate.linux.utf8.sql), but personally I think those are 99% a waste of time, precisely because they never actually get run by anyone but the author. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers