Re: BUG #1517: SQL interval syntax is accepted by the parser, - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #1517: SQL interval syntax is accepted by the parser,
Date
Msg-id 15385.1111618983@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #1517: SQL interval syntax is accepted by the parser,  (Roy Badami <roy@gnomon.org.uk>)
Responses Re: BUG #1517: SQL interval syntax is accepted by the parser,  (Roy Badami <roy@gnomon.org.uk>)
List pgsql-bugs
Roy Badami <roy@gnomon.org.uk> writes:
>     Roy> The 'constraint' (interval type descriptor or whatever it's
>     Roy> really called) is mandatory in standard SQL,

True.  (<interval qualifier> is what SQL99 calls it.)

> I have no objection to allowing things like
>    '1 hour 10 minutes' DAY TO SECOND
> but I'm just wondering whether the hybrid syntax is an unnecessary
> complication.

In the context of interval literals it's probably unnecessary, but
that's not the only thing to worry about.  In particular we have to
consider the behavior of the input and output routines for cases like
COPY.  I think it would be really bad to reject '1 hour 10 minutes' as
data input into an interval field just because it has an ISO qualifier.
Also, I would personally prefer to see the output from an interval field
remain in the Postgres format, precisely because the ISO format is
ambiguous without knowledge of the qualifier.  (Possibly we should
create a DateStyle-like GUC to determine that, but so far no one's
requested one.)

            regards, tom lane

pgsql-bugs by date:

Previous
From: Roy Badami
Date:
Subject: Re: BUG #1518: Conversions to (undocumented) SQL year-month
Next
From: Tom Lane
Date:
Subject: Re: BUG #1517: SQL interval syntax is accepted by the parser,