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 15892.1111622104@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:
>     Tom> Yes.  The ISO design for the datatype is pretty brain-dead if
>     Tom> you ask me --- the basic meaning of a data literal shouldn't
>     Tom> be so dependent on context.

> Arguably it's not, because the interval qualifier is an intrinsic (and
> mandatory) part of the literal syntax, so the full ISO interval is
> completely unambigous.

Well, it's okay *in the context of an interval literal*, where
everything you need to know is right there, even if some of it is inside
the quotes and some isn't.  The problem comes as soon as you consider
external data representations --- if you consider the bit inside the
quotes to be the preferred textual representation, then you have a
situation where you can't interpret the value without context
information that's not directly attached to the data.  This is why I say
it's ambiguous.

As you point out, the ISO spec doesn't actually say that that string
literal has to be the external textual representation ... but it's
surely pretty bizarre that it's not a good candidate to be the textual
representation.

            regards, tom lane

pgsql-bugs by date:

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