public inbox for [email protected]  
help / color / mirror / Atom feed
INTERVAL output format for iso_8601 is without dashes
4+ messages / 3 participants
[nested] [flat]

* INTERVAL output format for iso_8601 is without dashes
@ 2026-03-10 14:10 PG Doc comments form <[email protected]>
  2026-03-15 20:14 ` Re: INTERVAL output format for iso_8601 is without dashes Tom Lane <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: PG Doc comments form @ 2026-03-10 14:10 UTC (permalink / raw)
  To: [email protected]; +Cc: [email protected]

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/18/datatype-datetime.html
Description:

https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-OUTPUT

The output format for mixed Interval in style specification iso_8601 is
documented incorrectly.

The documentation says `P-1Y-2M3D​T-4H-5M-6S` while in reality there are no
dashes: `P1Y2M3D​T4H5M6S`






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

* Re: INTERVAL output format for iso_8601 is without dashes
  2026-03-10 14:10 INTERVAL output format for iso_8601 is without dashes PG Doc comments form <[email protected]>
@ 2026-03-15 20:14 ` Tom Lane <[email protected]>
  2026-03-16 11:39   ` Re: INTERVAL output format for iso_8601 is without dashes Benjamin Kröger <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2026-03-15 20:14 UTC (permalink / raw)
  To: [email protected]; +Cc: [email protected]

PG Doc comments form <[email protected]> writes:
> https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-OUTPUT
> The output format for mixed Interval in style specification iso_8601 is
> documented incorrectly.
> The documentation says `P-1Y-2M3D​T-4H-5M-6S` while in reality there are no
> dashes: `P1Y2M3D​T4H5M6S`

It looks correct to me:

regression=# set intervalstyle TO iso_8601;
SET
regression=# select '-1 year -2 mons +3 days -04:05:06'::interval;
      interval       
---------------------
 P-1Y-2M3DT-4H-5M-6S
(1 row)

			regards, tom lane





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

* Re: INTERVAL output format for iso_8601 is without dashes
  2026-03-10 14:10 INTERVAL output format for iso_8601 is without dashes PG Doc comments form <[email protected]>
  2026-03-15 20:14 ` Re: INTERVAL output format for iso_8601 is without dashes Tom Lane <[email protected]>
@ 2026-03-16 11:39   ` Benjamin Kröger <[email protected]>
  2026-03-16 13:44     ` Re: INTERVAL output format for iso_8601 is without dashes Tom Lane <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Benjamin Kröger @ 2026-03-16 11:39 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; +Cc: [email protected]


> PG Doc comments form <[email protected]> writes:
>> https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-OUTPUT
>> The output format for mixed Interval in style specification iso_8601 is
>> documented incorrectly.
>> The documentation says `P-1Y-2M3D​T-4H-5M-6S` while in reality there are no
>> dashes: `P1Y2M3D​T4H5M6S`
> 
> It looks correct to me:
> 
> regression=# set intervalstyle TO iso_8601;
> SET
> regression=# select '-1 year -2 mons +3 days -04:05:06'::interval;
>        interval
> ---------------------
>   P-1Y-2M3DT-4H-5M-6S
> (1 row)
> 
well, judging vom the columns `Year-Month Interval` and `Day-Time 
Interval` I didn't expect the input for the column `Mixed Interval` to 
have negative dimensions (since the other two are positive dimensions 
only). granted, I missed the positive three days :)

It might help to see the input values that led to the documented output 
values. If you look e.g. at the mixed interval output for style 
`postgres_verbose`, all dimensions are signed exactly opposite to the 
`iso_8601` style.





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

* Re: INTERVAL output format for iso_8601 is without dashes
  2026-03-10 14:10 INTERVAL output format for iso_8601 is without dashes PG Doc comments form <[email protected]>
  2026-03-15 20:14 ` Re: INTERVAL output format for iso_8601 is without dashes Tom Lane <[email protected]>
  2026-03-16 11:39   ` Re: INTERVAL output format for iso_8601 is without dashes Benjamin Kröger <[email protected]>
@ 2026-03-16 13:44     ` Tom Lane <[email protected]>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2026-03-16 13:44 UTC (permalink / raw)
  To: Benjamin Kröger <[email protected]>; +Cc: [email protected]

=?UTF-8?Q?Benjamin_Kr=C3=B6ger?= <[email protected]> writes:
> It might help to see the input values that led to the documented output 
> values. If you look e.g. at the mixed interval output for style 
> `postgres_verbose`, all dimensions are signed exactly opposite to the 
> `iso_8601` style.

I believe all the entries in each column of that table represent the
same value.  The reason for the sign difference in postgres_verbose
is that it uses "ago" to indicate an overall sign inversion.

			regards, tom lane





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


end of thread, other threads:[~2026-03-16 13:44 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-03-10 14:10 INTERVAL output format for iso_8601 is without dashes PG Doc comments form <[email protected]>
2026-03-15 20:14 ` Tom Lane <[email protected]>
2026-03-16 11:39   ` Benjamin Kröger <[email protected]>
2026-03-16 13:44     ` Tom Lane <[email protected]>

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