Re: creating index using function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Matthew Engelbert <mje1975(at)yahoo(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: creating index using function
Date: 2004-11-20 01:19:14
Message-ID: 594.1100913554@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Matthew Engelbert <mje1975(at)yahoo(dot)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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Vishal Kashyap @ [SaiHertz] 2004-11-21 08:49:57 Re: [OT] apache auth with postgres?
Previous Message Matthew Engelbert 2004-11-19 20:24:52 creating index using function