Skip site navigation (1) Skip section navigation (2)

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

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Roy Badami <roy(at)gnomon(dot)org(dot)uk>
Cc: 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-20 14:39:15
Message-ID: 200503201439.j2KEdFE16841@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Roy Badami wrote:
>     Bruce> 	select interval day to second '1 day 1 hour'
> 
>     Bruce> However, we don't support that syntax, only the one with
>     Bruce> the specification after.
> 
> Is that valid ANSI SQL? 

I guess my point is that we should allow:

	select interval '1' day '1' hour

as SQL standard and equavalent to:

	select interval '1 day 1 hour'

and if we need to specify the data type we would add it before
the data value:

	select interval day to second '1' day '1' hour

I see no way to support the SQL syntax and allow the data type
specification after the data value, and it doesn't make any sense to do
so because it isn't logical and probably not used by anyone, though we
might be able to support it as a specialized case.

We could accept:

	select interval year to month '1' month
	select interval year to month '1 month'

and as a special case:

	select interval '1 month' year to month

but not:

	select interval '1' year to month
	select interval year to month '1'

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

Responses

pgsql-bugs by date

Next:From: Roy BadamiDate: 2005-03-20 14:44:15
Subject: Re: BUG #1517: SQL interval syntax is accepted by the parser,
Previous:From: Roy BadamiDate: 2005-03-20 14:31:52
Subject: Re: BUG #1517: SQL interval syntax is accepted by the parser,

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group