Re: [PATCH] Leading minus for negative time interval in ISO 8601

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Chapman Flack <chap(at)anastigmatix(dot)net>
Cc: Mikhail Titov <mlt(at)gmx(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Leading minus for negative time interval in ISO 8601
Date: 2020-06-04 04:25:05
Message-ID: 1193722.1591244705@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Chapman Flack <chap(at)anastigmatix(dot)net> writes:
> On 06/03/20 22:46, Tom Lane wrote:
>> "Isn't quite clear"? ISTM that if the standard intended to allow that,
>> it'd be pretty clear. I looked through the 8601 spec just now, and
>> I can't see any indication whatever that they intend to allow "-" before P.

> Umm, did you see any indication that they intend to allow "-" /anywhere/
> in a time interval (with the exception of between year and month, month
> and day in the alternate form, as simple delimiters, not as minus?
> (Maybe you did; I'm looking at a publicly-accessible 2016 draft.)

I don't have an "official" copy either; I was looking at this draft:
https://www.loc.gov/standards/datetime/iso-tc154-wg5_n0038_iso_wd_8601-1_2016-02-16.pdf

I see this bit:

[±] represents a plus sign [+] if in combination with the following
element a positive value or zero needs to be represented (in this
case, unless explicitly stated otherwise, the plus sign shall not be
omitted), or a minus sign [−] if in combination with the following
element a negative value needs to be represented.

but I agree that there's no clear application of that to intervals,
either overall or per-field.

> Java durations allow both the PostgreSQL-style minus on individual
> components, and a leading minus that negates the whole thing. [1]
> That explicitly says "The leading plus/minus sign, and negative values
> for other units are not part of the ISO-8601 standard."
> XML Schema (and therefore XML Query, which uses XML Schema data types)
> allows only the leading minus. [2]

Hm. The slippery slope I *don't* want to be drawn down is somebody
arguing that we should change interval_out, because that would open
a whole Pandora's box of compatibility issues. Maybe we should just
take the position that negative intervals aren't standardized, and
if you want to transport them using ISO format then you first need
to lobby ISO to fix that.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mikhail Titov 2020-06-04 04:27:48 Re: [PATCH] Leading minus for negative time interval in ISO 8601
Previous Message Michael Paquier 2020-06-04 04:16:07 Re: Incorrect comment in be-secure-openssl.c