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

From Tom Lane
Subject Re: BUG #1517: SQL interval syntax is accepted by the parser,
Date
Msg-id 17296.1111255686@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #1517: SQL interval syntax is accepted by the parser,  (Roy Badami <roy@gnomon.org.uk>)
Responses Re: BUG #1517: SQL interval syntax is accepted by the parser,
List pgsql-bugs
Roy Badami <roy@gnomon.org.uk> writes:
> ie do you accept
>    interval '1 day 1 hour' day to second

I think we have to, and the reason is that this isn't different under
the hood from reading the external value '1 day 1 hour' and storing
it into a column that has the DAY TO SECOND typmod.  If we reject
the above we'd be breaking existing dump files.  Furthermore this
would imply that dump output from a constrained interval column
would *have to* not have any decoration; ie we could only output
'1 1' and not '1 day 1 hour'.  Regardless of what the spec says,
I find the former dangerously ambiguous.

I'm happy to see our code upgraded to accept the spec's syntax.
I won't be happy to see it changed to reject input that we used
to accept, especially when the only argument for doing so is a
narrow-minded insistence that we can't accept anything beyond
what the spec says.

            regards, tom lane

pgsql-bugs by date:

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