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

From: Roy Badami <roy(at)gnomon(dot)org(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Roy Badami <roy(at)gnomon(dot)org(dot)uk>, Bruce Momjian <pgman(at)candle(dot)pha(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-19 19:26:37
Message-ID: 16956.31981.88976.132259@giles.gnomon.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Roy Badami 2005-03-19 20:46:43 Re: BUG #1517: SQL interval syntax is accepted by the parser,
Previous Message Andrew - Supernews 2005-03-19 18:59:28 Re: BUG #1541: Unusually long INSERT times after fresh