pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: defanor@uberspace.net
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15141: Faulty ISO 8601 parsing
Date: Mon, 02 Apr 2018 20:17:49 -0400
Message-ID: <32337.1522714669@sss.pgh.pa.us> (raw)
In-Reply-To: <152271186941.1442.12179299369295226185@wrigleys.postgresql.org>
References: <152271186941.1442.12179299369295226185@wrigleys.postgresql.org>

=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> 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 with
> 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-03T01: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




view thread (7+ messages)  latest in thread

Message-ID: <32337.1522714669@sss.pgh.pa.us>
Permalink:  ../32337.1522714669@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/32337.1522714669@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, defanor@uberspace.net
  Subject: Re: BUG #15141: Faulty ISO 8601 parsing
  In-Reply-To: <32337.1522714669@sss.pgh.pa.us>
  References: <152271186941.1442.12179299369295226185@wrigleys.postgresql.org> <32337.1522714669@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox