pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Date/Time parsing of ISO 8601 timestamps with commas
4+ messages / 3 participants
[nested] [flat]

* Date/Time parsing of ISO 8601 timestamps with commas
@ 2025-10-09 23:43  Zane Duffield <duffieldzane@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Zane Duffield @ 2025-10-09 23:43 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org

I noticed today that PostgreSQL doesn't support parsing ISO 8601 timestamps
that use a comma as the decimal separator.

The section of the standard that describes this is 4.2.2.4

> the decimal fraction shall be divided from the integer part by the decimal
> sign specified in ISO 31-0, i.e. the comma [,] or full stop [.]. Of these,
> the comma is the preferred sign
>

I noticed this issue because a script I wrote used the unix `date` command
to generate a timestamp (later fed into PostgreSQL)

> $ date --iso-8601=ns
> 2025-10-10T10:38:59,386724473+11:00


I read over the documentation for Date/Time types:
https://www.postgresql.org/docs/18/datatype-datetime.html

> Date and time input is accepted in almost any reasonable format, including
> ISO 8601


but there is no clarification on this page that the comma is not supported
as the decimal separator.

Thanks,
Zane

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Date/Time parsing of ISO 8601 timestamps with commas
@ 2025-10-10 20:09  Nathan Bossart <nathandbossart@gmail.com>
  parent: Zane Duffield <duffieldzane@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Nathan Bossart @ 2025-10-10 20:09 UTC (permalink / raw)
  To: Zane Duffield <duffieldzane@gmail.com>; +Cc: pgsql-bugs@lists.postgresql.org

On Fri, Oct 10, 2025 at 10:43:04AM +1100, Zane Duffield wrote:
> I noticed today that PostgreSQL doesn't support parsing ISO 8601 timestamps
> that use a comma as the decimal separator.

I found various threads about this in the archives, including this one:

	https://postgr.es/m/flat/152271186941.1442.12179299369295226185%40wrigleys.postgresql.org

-- 
nathan





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Date/Time parsing of ISO 8601 timestamps with commas
@ 2025-10-10 20:30  David G. Johnston <david.g.johnston@gmail.com>
  parent: Nathan Bossart <nathandbossart@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: David G. Johnston @ 2025-10-10 20:30 UTC (permalink / raw)
  To: Nathan Bossart <nathandbossart@gmail.com>; +Cc: Zane Duffield <duffieldzane@gmail.com>; pgsql-bugs@lists.postgresql.org

On Fri, Oct 10, 2025 at 4:09 PM Nathan Bossart <nathandbossart@gmail.com>
wrote:

> On Fri, Oct 10, 2025 at 10:43:04AM +1100, Zane Duffield wrote:
> > I noticed today that PostgreSQL doesn't support parsing ISO 8601
> timestamps
> > that use a comma as the decimal separator.
>
> I found various threads about this in the archives, including this one:
>
>
> https://postgr.es/m/flat/152271186941.1442.12179299369295226185%40wrigleys.postgresql.org
>
>
If there are indeed various threads we might want to update the
documentation to make it clear that we say "almost" because we don't
correctly interpret formats that have substituted a comma for a full-stop.
(And maybe other exceptions.)

Or, I suppose, Appendix B.1 step 1 should include a 5th note (or maybe add
a step 0): "If the token is a comma it is replaced by a space".

David J.

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Date/Time parsing of ISO 8601 timestamps with commas
@ 2025-10-10 20:45  Zane Duffield <duffieldzane@gmail.com>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Zane Duffield @ 2025-10-10 20:45 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; Nathan Bossart <nathandbossart@gmail.com>; +Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>

That linked thread covers the topic quite well. I didn't find it because the search function on the website only goes back 1 year.

I think adding some note to the documentation would be appropriate.

________________________________
From: David G. Johnston <david.g.johnston@gmail.com>
Sent: Saturday, October 11, 2025 7:30:01 AM
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Zane Duffield <duffieldzane@gmail.com>; pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: Date/Time parsing of ISO 8601 timestamps with commas

On Fri, Oct 10, 2025 at 4:09 PM Nathan Bossart <nathandbossart@gmail.com<mailto:nathandbossart@gmail.com>> wrote:
On Fri, Oct 10, 2025 at 10:43:04AM +1100, Zane Duffield wrote:
> I noticed today that PostgreSQL doesn't support parsing ISO 8601 timestamps
> that use a comma as the decimal separator.

I found various threads about this in the archives, including this one:

        https://postgr.es/m/flat/152271186941.1442.12179299369295226185%40wrigleys.postgresql.org


If there are indeed various threads we might want to update the documentation to make it clear that we say "almost" because we don't correctly interpret formats that have substituted a comma for a full-stop. (And maybe other exceptions.)

Or, I suppose, Appendix B.1 step 1 should include a 5th note (or maybe add a step 0): "If the token is a comma it is replaced by a space".

David J.



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2025-10-10 20:45 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-10-09 23:43 Date/Time parsing of ISO 8601 timestamps with commas Zane Duffield <duffieldzane@gmail.com>
2025-10-10 20:09 ` Nathan Bossart <nathandbossart@gmail.com>
2025-10-10 20:30   ` David G. Johnston <david.g.johnston@gmail.com>
2025-10-10 20:45     ` Zane Duffield <duffieldzane@gmail.com>

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