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

Поиск
Список
Период
Сортировка
От Roy Badami
Тема Re: BUG #1517: SQL interval syntax is accepted by the parser,
Дата
Msg-id 16956.31981.88976.132259@giles.gnomon.org.uk
обсуждение исходный текст
Ответ на Re: BUG #1517: SQL interval syntax is accepted by the parser,  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: BUG #1517: SQL interval syntax is accepted by the parser,  (Roy Badami <roy@gnomon.org.uk>)
Список pgsql-bugs
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:

    >> ie do you accept interval '1 day 1 hour' day to second

    Tom> I think we have to, and the reason is that this isn't
    Tom> different under the hood from reading the external value '1
    Tom> day 1 hour' and storing it into a column that has the DAY TO
    Tom> SECOND typmod.

I don't know anything about the postgres internals, but I don't see it
has to be this way.

    INTERVAL '1 day 1 hour' DAY TO SECOND

won't occur in any existing dump file.  But if it's important to treat
this the same as casting the string '1 day 1 hour' to type INTERVAL
DAY TO SECOND then yes, you'll have to accept it.

But this is just syntax; I don't see why you have to interpret it that
way...

But on refelction if you want to treat

    INTERVAL 'postgres-interval' ansi-interval-type

as equivalent to

    CAST (INTERVAL 'postgres-interval' AS INTERVAL ansi-interval-type)

that's probably not unreasonable.  Though it creates an inconsistency
with the current (undocumented) postgresism of treating

    INTERVAL '1'

as

    INTERVAL '1 second'

since clearly you can't treat the ANSI interval

    INTERVAL '1' HOUR

as
    CAST (INTERVAL '1 second' AS INTERVAL HOUR)



    -roy

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

Предыдущее
От: Andrew - Supernews
Дата:
Сообщение: Re: BUG #1541: Unusually long INSERT times after fresh
Следующее
От: Roy Badami
Дата:
Сообщение: Re: BUG #1517: SQL interval syntax is accepted by the parser,