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

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: BUG #1517: SQL interval syntax is accepted by the parser,
Дата
Msg-id 200503201418.j2KEIC303047@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: BUG #1517: SQL interval syntax is accepted by the parser,  (Roy Badami <roy@gnomon.org.uk>)
Ответы Re: BUG #1517: SQL interval syntax is accepted by the parser,  (Roy Badami <roy@gnomon.org.uk>)
Re: BUG #1517: SQL interval syntax is accepted by the parser,  (Roy Badami <roy@gnomon.org.uk>)
Re: BUG #1517: SQL interval syntax is accepted by the parser,  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Roy Badami wrote:
>     Tom> Feel like hacking the code?
>
> Hmm, in principle I might take a look some time; in reality it's
> unlikely I'll have time any time soon...
>
> There are some design issues involved, though.  If you have the type
> modifier, do you isnist on SQL syntax in the string?
>
> ie do you accept
>
>    select interval '1 day 1 hour' day to second
>
> Personally I think it would be a bad idea to allow hybrid SQL/postgres
> syntax like this.

I am wondering why we allow the 'interval' data type specification to be
after the string.  It seems this should be written as:

    select interval day to second '1 day 1 hour'

However, we don't support that syntax, only the one with the
specification after.

Timestamp does it logically with 'time zone':

    test=> select timestamp with time zone '2004-01-01';
          timestamptz
    ------------------------
     2004-01-01 00:00:00-05
    (1 row)

    test=> select timestamp '2004-01-01' with time zone;
    ERROR:  syntax error at or near "with" at character 31

So, I am thinking we should allow something like this:

    interval day to second '1' hour

where the 'day to second' is the interval data type specification and
'hour' is the data value specification.

I realize this might break backward compatibility but we never
documented that syntax and we need to use it to be consistent with the
SQL standard.

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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #1517: SQL interval syntax is accepted by the parser,
Следующее
От: Roy Badami
Дата:
Сообщение: Re: BUG #1517: SQL interval syntax is accepted by the parser,