Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f39eC-0005XS-Ax for pgsql-bugs@arkaria.postgresql.org; Tue, 03 Apr 2018 00:18:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f39eA-0002sr-9h for pgsql-bugs@arkaria.postgresql.org; Tue, 03 Apr 2018 00:17:58 +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.89) (envelope-from ) id 1f39eA-0002si-3d for pgsql-bugs@lists.postgresql.org; Tue, 03 Apr 2018 00:17:58 +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.89) (envelope-from ) id 1f39e4-0006ex-7z for pgsql-bugs@lists.postgresql.org; Tue, 03 Apr 2018 00:17:57 +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 w330Hntb032338; Mon, 2 Apr 2018 20:17:49 -0400 From: Tom Lane To: defanor@uberspace.net cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15141: Faulty ISO 8601 parsing In-reply-to: <152271186941.1442.12179299369295226185@wrigleys.postgresql.org> References: <152271186941.1442.12179299369295226185@wrigleys.postgresql.org> Comments: In-reply-to =?utf-8?q?PG_Bug_reporting_form?= message dated "Mon, 02 Apr 2018 23:31:09 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <32336.1522714669.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 02 Apr 2018 20:17:49 -0400 Message-ID: <32337.1522714669@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =3D?utf-8?q?PG_Bug_reporting_form?=3D writes: > The time parsing fails on some valid ISO times, with some locales, e.g.: > # select to_timestamp('2018-04-03T01:45:00,728456785+0000')::timestamp w= ith > time zone; > ERROR: invalid input syntax for type double precision: > "2018-04-03T01:45:00,728456785+0000" This is confused: the single-argument form of to_timestamp() takes a float8 argument, not a timestamp, which is why the error message is phrased the way it is. I think you meant that this fails: # select '2018-04-03T01:45:00,728456785+0000'::timestamp with time zone; ERROR: invalid input syntax for type timestamp with time zone: "2018-04-0= 3T01:45:00,728456785+0000" which it does, but I don't think we should do anything about it. There is not and never has been any dependency on LC_TIME properties in PG's timestamp I/O. Considering that we also have DateStyle to cope with, as well as a lot more flexibility in the input parser than ISO 8601 contemplates, I think allowing a comma instead of decimal point here would probably create more confusion than benefit. (Also, this is not the only aspect of 8601 that we don't support; for instance the option to specify fractional minutes or hours instead of fractional seconds. There again, I think the potential for confusion and error outweighs any benefit from being nominally more standards-compliant.) You probably could read data formatted this way using the two-argument form of to_timestamp() with a suitable format string. regards, tom lane