Re: Error trying to create a functional index. - Mailing list pgsql-sql

From Jochem van Dieten
Subject Re: Error trying to create a functional index.
Date
Msg-id 3C3AD7A0.9090304@dev.null
Whole thread Raw
In response to Re: Error trying to create a functional index.  (CoL <col@mportal.hu>)
List 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



pgsql-sql by date:

Previous
From: "steve boyle"
Date:
Subject: Re: create table with multiple unique fields
Next
From: Tom Lane
Date:
Subject: Re: who has lock on table/row