Re: Error trying to create a functional index.

Поиск
Список
Период
Сортировка
От Jochem van Dieten
Тема Re: Error trying to create a functional index.
Дата
Msg-id 3C3AD7A0.9090304@dev.null
обсуждение исходный текст
Ответ на Re: Error trying to create a functional index.  (CoL <col@mportal.hu>)
Список 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 по дате отправления:

Предыдущее
От: "steve boyle"
Дата:
Сообщение: Re: create table with multiple unique fields
Следующее
От: Tom Lane
Дата:
Сообщение: Re: who has lock on table/row