Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eGBup-0004SJ-Bp for pgsql-hackers@arkaria.postgresql.org; Sat, 18 Nov 2017 22:48:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eGBuo-0005aA-PH for pgsql-hackers@arkaria.postgresql.org; Sat, 18 Nov 2017 22:48:46 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eGBuo-0005a0-Gn for pgsql-hackers@lists.postgresql.org; Sat, 18 Nov 2017 22:48:46 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eGBuh-0004FA-1g for pgsql-hackers@postgresql.org; Sat, 18 Nov 2017 22:48:45 +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 vAIMmQe1029638; Sat, 18 Nov 2017 17:48:26 -0500 From: Tom Lane To: Artur Zakirov cc: amul sul , Pavel Stehule , Robert Haas , "David G. Johnston" , Alex Ignatov , Bruce Momjian , amul sul , PostgreSQL-development Subject: Re: [HACKERS] Bug in to_timestamp(). In-reply-to: References: <1873520224.1784572.1465833145330.JavaMail.yahoo.ref@mail.yahoo.com> <1873520224.1784572.1465833145330.JavaMail.yahoo@mail.yahoo.com> <884791796.213185.1466667686999.JavaMail.yahoo@mail.yahoo.com> <20160623133001.GF21246@momjian.us> <1877e60a-a970-18b5-453c-e342f96150e6@postgrespro.ru> <31915.1466703655@sss.pgh.pa.us> <32684.1466704957@sss.pgh.pa.us> <734e50cd-c563-4afd-d1c8-80f244b3265e@postgrespro.ru> <29142.1475097531@sss.pgh.pa.us> <8744.1478284597@sss.pgh.pa.us> Comments: In-reply-to Artur Zakirov message dated "Sun, 06 Nov 2016 17:26:57 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <29636.1511045306.1@sss.pgh.pa.us> Date: Sat, 18 Nov 2017 17:48:26 -0500 Message-ID: <29637.1511045306@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Artur Zakirov writes: > [ 0001-to-timestamp-format-checking-v7.patch ] This patch needs a rebase over the formatting.c fixes that have gone in over the last couple of days. Looking at the rejects, I notice that in your changes to parse_format(), you seem to be making it rely even more heavily on remembering state about the previous input. I recommend against that --- it was broken before, and it's a pretty fragile approach. Backslashes are not that hard to deal with in-line. The larger picture though is that I'm not real sure that this patch is going in the direction we want. All of these cases work in both our code and Oracle: select to_timestamp('97/Feb/16', 'YY:Mon:DD') select to_timestamp('97/Feb/16', 'YY Mon DD') select to_timestamp('97 Feb 16', 'YY/Mon/DD') (Well, Oracle thinks these mean 2097 where we think 1997, but the point is you don't get an error.) I see from your regression test additions that you want to make some of these throw an error, and I think that any such proposal is dead in the water. Nobody is going to consider it an improvement if it both breaks working PG apps and disagrees with Oracle. regards, tom lane