Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGTGQ-0006GS-BT for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Jun 2016 15:43:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bGTGO-00027B-I8 for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Jun 2016 15:43:24 +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 1bGTF1-0000cf-R5 for pgsql-hackers@postgresql.org; Fri, 24 Jun 2016 15:42:00 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGTEt-0004mk-UV for pgsql-hackers@postgresql.org; Fri, 24 Jun 2016 15:41:58 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id EC2F421C9073; Fri, 24 Jun 2016 18:41:49 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Received: from mail.postgrespro.ru ([127.0.0.1]) by localhost (mail.postgrespro.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Syo78XIURQ05; Fri, 24 Jun 2016 18:41:48 +0300 (MSK) Received: from [192.168.27.30] (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id 3AED421C9061; Fri, 24 Jun 2016 18:41:48 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1466782908; bh=1Hcx2itJw+ATYQ8+invCALI5A55wCD44Fx6J6FP5JWQ=; h=Subject:To:References:Cc:From:Date:In-Reply-To; b=XSMzQRhFG6M9X1jAVLUxQl80fvnxcns58OrMQxU/+0t1MAfrt2ZknpG0c/UoHx0uw DDBQ0nDAxdRyn6MfPgA108vqFxJVsx6hjMsnta6cS3dQYswtADqeqtcHq/7GkSZMQK XcMDyTjcI9m/X16Hoc4Pjpi3fDwy7lVV+MOUXofc= Subject: Re: Bug in to_timestamp(). To: Tom Lane , Robert Haas 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> Cc: "David G. Johnston" , Bruce Momjian , amul sul , PostgreSQL-development From: Alex Ignatov Message-ID: <4bb0a571-2211-7c97-0826-dfaf20cc9e21@postgrespro.ru> Date: Fri, 24 Jun 2016 18:41:46 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <31915.1466703655@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -3.4 (---) 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 On 23.06.2016 20:40, Tom Lane wrote: > Robert Haas writes: >> On Thu, Jun 23, 2016 at 1:12 PM, David G. Johnston >> wrote: >>> My understanding is that is not going to change for 9.6. >> That's exactly what is under discussion here. > I would definitely agree with David on that point. Making to_timestamp > noticeably better on this score seems like a nontrivial project, and > post-beta is not the time for that sort of thing, even if we had full > consensus on what to do. I'd suggest somebody work on a patch and put > it up for review in the next cycle. > > Now, if you were to narrowly define the problem as "whether to skip > non-spaces for a space in the format", maybe that could be fixed > post-beta, but I think that's a wrongheaded approach. to_timestamp's > issues with input that doesn't match the format are far wider than that. > IMO we should try to resolve the whole problem with one coherent change, > not make incremental incompatible changes at the margins. > > At the very least I'd want to see a thought-through proposal that > addresses all three of these interrelated points: > > * what should a space in the format match > * what should a non-space, non-format-code character in the format match > * how should we handle fields that are not exactly the width suggested > by the format > > regards, tom lane > > Totally agree that we need more discussion about error handling in this function! Also this behavior is observed in to_date() and to_number() function: postgres=# SELECT TO_DATE('2!0!1!6----!0!6-/-/-/-/-/-/-1!/-/-/-/-/-/-/-3!', 'YYYY-MM-DD'); to_date ------------ 0002-01-01 (1 row) postgres=# postgres=# select to_number('1$#@!!,2,%,%4,5,@%5@4..8-', '999G999D9S'); to_number ----------- 12 (1 row) On the our side we have some discussions about to write a patch that will change this incorrect behavior. So stay tuned. -- Alex Ignatov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers