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 | 200503240339.j2O3dRh06332@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,
|
| Список | pgsql-bugs |
Roy Badami wrote:
> Roy> The 'constraint' (interval type descriptor or whatever it's
> Roy> really called) is mandatory in standard SQL, I think, so
> Roy> there's no ambiguity anyway, unless anyone is using this
> Roy> undocumented syntax at the moment...
>
> Incidentally, this was the ratinale behind my earlier suggestion, that:
>
> * if the interval type descriptor is absent, parse the interval as a
> traditional postgres interval
>
> * if the interval type descriptor is present, parse the interval according
> to the standard syntax
>
> I have no objection to allowing things like
>
> '1 hour 10 minutes' DAY TO SECOND
>
> but I'm just wondering whether the hybrid syntax is an unnecessary
> complication.
Added to TODO:
o For syntax that isn't uniquely ISO or PG syntax, like '1:30' or
'1', treat as ISO if there is a range specification clause,
and as PG if there no clause is present, e.g. interpret '1:30'
MINUTE TO SECOND as '1 minute 30 seconds', and interpret '1:30'
as '1 hour, 30 minutes'
This brings up the issue of how we are to output interval values.
Currently we do:
test=> select interval '1 hour 1 minute';
interval
----------
01:01:00
(1 row)
and
test=> select interval '1 hour 1 second' hour to minute;
interval
----------
01:00:00
(1 row)
so I think we are OK because we don't output ambiguous syntax.
--
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 по дате отправления: