create index with substr function

Поиск
Список
Период
Сортировка
От Ray
Тема create index with substr function
Дата
Msg-id 069201c4b715$34851670$0f6010ac@raysiu
обсуждение исходный текст
Ответы Re: create index with substr function  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: create index with substr function  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Re: create index with substr function  (Rosser Schwarz <rosser.schwarz@gmail.com>)
Список pgsql-performance
Hi All,
 
I have a table in my postgres:
Table: doc
     Column     |            Type             | Modifiers
     ---------------+-----------------------------+-----------
 doc_id          | bigint                      | not null
 comp_grp_id | bigint                      | not null
 doc_type      | character varying(10)| not null
 doc_urn        | character varying(20)| not null
I want to create an index on doc_urn column with using substr function like this:
CREATE INDEX idx_doc_substr_doc_urn ON doc USING btree (SUBSTR(doc_urn,10));
 
but there is an error:

ERROR:  parser: parse error at or near "10" at character 68
 
what's wrong for this SQL? As I have found some reference on the internet, I can't find anything wrong in this SQL.
 
Thanks
Ray

В списке pgsql-performance по дате отправления:

Предыдущее
От: jelle
Дата:
Сообщение: iostat question
Следующее
От: Tom Lane
Дата:
Сообщение: Re: create index with substr function