Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZZYN-0005Sg-Jw for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 08:16:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZZYM-0004To-8Y for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 08:16:54 +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 1bZZWy-0002wY-9t for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 08:15:28 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZZWs-0008IT-W7 for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 08:15:26 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 67F2A21C2DB3; Tue, 16 Aug 2016 11:15:20 +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 VmOzRxpZVd3N; Tue, 16 Aug 2016 11:15:20 +0300 (MSK) Received: from [192.168.27.153] (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id 39FCD21C2DAD; Tue, 16 Aug 2016 11:15:20 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1471335320; bh=bdT5Ex4edvcdyaTSBZ7vwv/XFwsxVq1nAfVE4IBETTI=; h=Subject:To:References:Cc:From:Date:In-Reply-To; b=ShF451jTHqOYNrtxi/6qkPrOORGZdJQdyQddqQJudHlltRCdJpA1yjxDPbBrAHAYX CN6eZZUYKEU8Hq8YlM3jB5T96xLJW6CWPzjAwHAebt/fb8NiGkc84gxW/6kXUQpvPx +PPdcrEOY7Ne7KumgZ+DQ/I4sYm3C4yXIw1rkNYY= Subject: Re: Bug in to_timestamp(). To: Robert Haas , amul sul References: <1873520224.1784572.1465833145330.JavaMail.yahoo.ref@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> <1285870380.13225431.1471272994354.JavaMail.yahoo@mail.yahoo.com> Cc: Pavel Stehule , Tom Lane , "David G. Johnston" , Alex Ignatov , Bruce Momjian , PostgreSQL-development From: Artur Zakirov Message-ID: Date: Tue, 16 Aug 2016 11:14:36 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.5 (--) 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 15.08.2016 19:28, Robert Haas wrote: > > Well, what's the Oracle behavior in any of these cases? I don't think > we can decide to change any of this behavior without knowing that. If > a proposed behavior change is incompatible with our previous releases, > I think it'd better at least be more compatible with Oracle. > Otherwise, we're just changing from an established behavior that we > invented ourselves to a new behavior we invented ourselves, which is > only worthwhile if it's absolutely clear that the new behavior is way > better. > 1 - Oracle's output for first queries is: -> SELECT TO_TIMESTAMP('2015-12-31 13:43:36', 'YYYY MM DD HH24 MI SS') FROM dual; TO_TIMESTAMP('2015-12-3113:43:36','YYYYMMDDHH24MISS') --------------------------------------------------------------------------- 31-DEC-15 01.43.36.000000000 PM -> SELECT TO_TIMESTAMP('2011$03!18 23_38_15', 'YYYY-MM-DD HH24:MI:SS') FROM dual; TO_TIMESTAMP('2011$03!1823_38_15','YYYY-MM-DDHH24:MI:SS') --------------------------------------------------------------------------- 18-MAR-11 11.38.15.000000000 PM -> SELECT TO_TIMESTAMP('2011*03!18 #%23^38$15', 'YYYY-MM-DD$$$HH24:MI:SS') FROM dual; TO_TIMESTAMP('2011*03!18#%23^38$15','YYYY-MM-DD$$$HH24:MI:SS') --------------------------------------------------------------------------- 18-MAR-11 11.38.15.000000000 PM PostgreSQL with the patch gives "ERROR: expected space character in given string". I will fix this. 2 - Oracle's output for query with hyphen is: -> SELECT TO_TIMESTAMP('2013--10-01', 'YYYY-MM-DD') FROM dual; SELECT TO_TIMESTAMP('2013--10-01', 'YYYY-MM-DD') FROM dual * ERROR at line 1: ORA-01843: not a valid month Here PostgreSQL with the patch does not give an error. So I will fix this too. 3 - The last two queries give an error. This patch do not handle such queries intentionally, because there is the thread https://www.postgresql.org/message-id/57786490.9010201%40wars-nicht.de . That thread concerns to_date() function. But it should concerns to_timestamp() also. So I suppose that should be a different patch for this last case. -- Artur Zakirov Postgres Professional: http://www.postgrespro.com 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