public inbox for [email protected]  
help / color / mirror / Atom feed
From: Benjamin Kröger <[email protected]>
To: Tom Lane <[email protected]>
Cc: [email protected]
Subject: Re: INTERVAL output format for iso_8601 is without dashes
Date: Mon, 16 Mar 2026 12:39:32 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[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.





view thread (4+ messages)  latest in thread

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: INTERVAL output format for iso_8601 is without dashes
  In-Reply-To: <[email protected]>

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

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