Re: BUG #1517: SQL interval syntax is accepted by the parser, - Mailing list pgsql-bugs

From Roy Badami
Subject Re: BUG #1517: SQL interval syntax is accepted by the parser,
Date
Msg-id 16956.31981.88976.132259@giles.gnomon.org.uk
Whole thread Raw
In response to Re: BUG #1517: SQL interval syntax is accepted by the parser,  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #1517: SQL interval syntax is accepted by the parser,  (Roy Badami <roy@gnomon.org.uk>)
List 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 by date:

Previous
From: Andrew - Supernews
Date:
Subject: Re: BUG #1541: Unusually long INSERT times after fresh
Next
From: Roy Badami
Date:
Subject: Re: BUG #1517: SQL interval syntax is accepted by the parser,