While doing the previous post, I found that the following fails, should it?

PG 7.3.2 on FreeBSD:


ler=# \df interval
                         List of functions
 Result data type |   Schema   |   Name   |  Argument data types
------------------+------------+----------+------------------------
 interval         | pg_catalog | interval | reltime
 interval         | pg_catalog | interval | text
 interval         | pg_catalog | interval | time without time zone
(3 rows)

ler=# select interval('6 months');
ERROR:  parser: parse error at or near "'6 months'" at character 17
ler=# select interval('6 months'::text);
ERROR:  parser: parse error at or near "'6 months'" at character 17
ler=#
-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749




Thu, 13 Mar 2003 20:41:03 -0600
Larry Rosenman <ler@lerctr.org>
Hrm. interval() function? 
> ler=# select interval('6 months');
> ERROR:  parser: parse error at or near "'6 months'" at character 17
> ler=# select interval('6 months'::text);
> ERROR:  parser: parse error at or near "'6 months'" at character 17
> ler=#

Try:

select "interval"('6 months');

Chris


Fri, 14 Mar 2003 10:49:28 +0800
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au>
Re: Hrm. interval() function? 


--On Friday, March 14, 2003 10:49:28 +0800 Christopher Kings-Lynne 
<chriskl@familyhealth.com.au> wrote:

>> ler=# select interval('6 months');
>> ERROR:  parser: parse error at or near "'6 months'" at character 17
>> ler=# select interval('6 months'::text);
>> ERROR:  parser: parse error at or near "'6 months'" at character 17
>> ler=#
>
> Try:
>
> select "interval"('6 months');
>
That works, but is non-intuitive.  I assume this is a reserved word issue?

Can it be fixed?

LER

> Chris



-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749




Thu, 13 Mar 2003 20:50:40 -0600
Larry Rosenman <ler@lerctr.org>
Re: Hrm. interval() function? 
> >> ler=# select interval('6 months');
> >> ERROR:  parser: parse error at or near "'6 months'" at character 17
> >> ler=# select interval('6 months'::text);
> >> ERROR:  parser: parse error at or near "'6 months'" at character 17
> >> ler=#
> >
> > Try:
> >
> > select "interval"('6 months');
> >
> That works, but is non-intuitive.  I assume this is a reserved word issue?

It's been like that since 7.2 introduced sql standard syntax for various
timestmap things.

> Can it be fixed?

Nope - the correct way to use that function is this:

select interval '6 months';

Chris


Fri, 14 Mar 2003 10:52:46 +0800
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au>
Re: Hrm. interval() function? 


--On Friday, March 14, 2003 10:52:46 +0800 Christopher Kings-Lynne 
<chriskl@familyhealth.com.au> wrote:

>> >> ler=# select interval('6 months');
>> >> ERROR:  parser: parse error at or near "'6 months'" at character 17
>> >> ler=# select interval('6 months'::text);
>> >> ERROR:  parser: parse error at or near "'6 months'" at character 17
>> >> ler=#
>> >
>> > Try:
>> >
>> > select "interval"('6 months');
>> >
>> That works, but is non-intuitive.  I assume this is a reserved word
>> issue?
>
> It's been like that since 7.2 introduced sql standard syntax for various
> timestmap things.
>
>> Can it be fixed?
>
> Nope - the correct way to use that function is this:
>
> select interval '6 months';
Drat, SQL gets me again :-).

Thanks,
LER

>
> Chris



-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749




Thu, 13 Mar 2003 21:02:27 -0600
Larry Rosenman <ler@lerctr.org>
Re: Hrm. interval() function? 