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

From: Roy Badami <roy(at)gnomon(dot)org(dot)uk>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Roy Badami <roy(at)gnomon(dot)org(dot)uk>, Tom Lane <tgl(at)sss(dot)pgh(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 20:41:07
Message-ID: 16961.54371.882191.556057@giles.gnomon.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


Bruce> The reason I added it is that usually people think of the
Bruce> PG syntax as '1 hour 30 seconds'. The '1:30' is a kind of
Bruce> subtle because both PG and ANSI support that syntax and we
Bruce> need to handle that. The tricky part is that we can't say
Bruce> by looking at '1:30' whether it is PG or ANSI, and that
Bruce> will affect how we deal with the clause after it.

It could be either in ANSI:

INTERVAL '1:30' MINUTE TO SECOND
INTERVAL '1:30' HOUR TO MINUTE

Similarly, pg interprets

INTERVAL '1'

as

INTERVAL '1 second'

In ANSI, it could be any one of

INTERVAL '1' SECOND
INTERVAL '1' MINUTE
INTERVAL '1' HOUR
INTERVAL '1' DAY
INTERVAL '1' MONTH
INTERVAL '1' YEAR

In ANSI you can only parse the string by reference to the interval type.

-roy

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Keith Browne 2005-03-23 20:55:07 Re: BUG #1552: massive performance hit between 7.4 and 8.0.1
Previous Message Bruce Momjian 2005-03-23 20:31:09 Re: BUG #1517: SQL interval syntax is accepted by the parser,