Re: Error trying to create a functional index.

From: Jochem van Dieten <nomail(at)dev(dot)null>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Error trying to create a functional index.
Date: 2002-01-08 11:27:28
Message-ID: 3C3AD7A0.9090304@dev.null
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

CoL wrote:

> Steve: of course you can make functional indices:
>
> So why this not workin???? (not workin for me 2 too, pg 7.1.3)
> "CREATE INDEX eventdateindex ON event (date_trunc('day', eventstamp));"
>
> ----------------
> 7.5. Functional Indices
> For a functional index, an index is defined on the result of a function
> applied to one or more columns of a single table. Functional indices can
> be used to obtain fast access to data based on the result of function
> calls.
> For example, a common way to do case-insensitive comparisons is to use
> the lower:
> SELECT * FROM test1 WHERE lower(col1) = 'value';
> In order for that query to be able to use an index, it has to be defined
> on the result of the lower(column) operation:
> CREATE INDEX test1_lower_col1_idx ON test1 (lower(col1));
> The function in the index definition can take more than one argument,
> but they must be table columns, not constants.

Wouldn't your problem be that 'day' is a constant?

Jochem

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message CoL 2002-01-08 11:57:27 Re: Error trying to create a functional index.
Previous Message steve boyle 2002-01-08 10:21:17 Re: Retrieving information from System Tables