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 8086.1111341004@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #1517: SQL interval syntax is accepted by the parser,  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-bugs
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> I guess my point is that we should allow:

>     select interval '1' day '1' hour

> as SQL standard

Where do you get that that's in the SQL standard?

What is in the standard is

         <interval literal> ::=
              INTERVAL [ <sign> ] <interval string> <interval qualifier>

         <interval string> ::=
              <quote> { <year-month literal> | <day-time literal> } <quote>

         <interval qualifier> ::=
                <start field> TO <end field>
              | <single datetime field>

<interval qualifier> is defined in SQL92 10.1 --- I won't repeat the
whole BNF for it because it's tedious, but the point here is that you
get *one* string and *one* qualifier, in that order.

(I notice that we don't have the <sign> accounted for yet, btw, but
the rest of the syntax seems to be up to speed.)

            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: Tom Lane
Date:
Subject: Re: BUG #1517: SQL interval syntax is accepted by the parser,