Re: BUG #1517: SQL interval syntax is accepted by the parser,

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Roy Badami <roy(at)gnomon(dot)org(dot)uk>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1517: SQL interval syntax is accepted by the parser,
Date: 2005-03-23 23:55:04
Message-ID: 15892.1111622104@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Roy Badami <roy(at)gnomon(dot)org(dot)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

In response to

Responses

Browse pgsql-bugs by date

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