Re: creating index using function - Mailing list pgsql-novice

From Tom Lane
Subject Re: creating index using function
Date
Msg-id 594.1100913554@sss.pgh.pa.us
Whole thread Raw
In response to creating index using function  (Matthew Engelbert <mje1975@yahoo.com>)
List pgsql-novice
Matthew Engelbert <mje1975@yahoo.com> writes:
> CREATE INDEX ecn_sales_index_day on ecn_sales (extract(DOY FROM tv_time));
> ERROR:  syntax error at or near "(" at character 55

Assuming you're using 7.4, put an extra pair of parens there:

CREATE INDEX ecn_sales_index_day on ecn_sales ((extract(DOY FROM tv_time)));

In earlier PG versions you'll need a wrapper function around the extract
call.  It looks like a function, but it isn't quite one because of the
weird syntax.

            regards, tom lane

pgsql-novice by date:

Previous
From: Matthew Engelbert
Date:
Subject: creating index using function
Next
From: "Dzial Techniczny"
Date:
Subject: [OT] apache auth with postgres?