Thread: No Interval Conversion Function in 7.2?!!?

No Interval Conversion Function in 7.2?!!?

From
"Josh Berkus"
Date:
Folks,

Please help!  I just upgraded a production database to PostgreSQL 7.2,and discovered that INTERVAL() is no longer a
function. What replacedit?  How can I convert VARCHAR to Interval?
 

-Josh

______AGLIO DATABASE SOLUTIONS___________________________                                      Josh Berkus Complete
informationtechnology      josh@agliodbs.com  and data management solutions       (415) 565-7293 for law firms, small
businesses       fax 621-2533   and non-profit organizations.      San Francisco
 


Re: No Interval Conversion Function in 7.2?!!?

From
Tom Lane
Date:
"Josh Berkus" <josh@agliodbs.com> writes:
> Please help!  I just upgraded a production database to PostgreSQL 7.2,
>  and discovered that INTERVAL() is no longer a function.  What replaced
>  it?  How can I convert VARCHAR to Interval?

It's still there, but INTERVAL is a reserved word these days.
"INTERVAL"(varcharvalue)
varcharvalue::interval
CAST(varcharvalue AS interval)

should all give the same results.  Only the last of these is actually
standard.
        regards, tom lane


Re: No Interval Conversion Function in 7.2?!!?

From
Tom Lane
Date:
I said:
>     "INTERVAL"(varcharvalue)

Sigh, that one should be
"interval"(varcharvalue)
        regards, tom lane