Creating index with UPPER
| От | Michael Fork |
|---|---|
| Тема | Creating index with UPPER |
| Дата | |
| Msg-id | Pine.BSI.4.21.0012121507260.10040-100000@glass.toledolink.com обсуждение исходный текст |
| Ответы |
Re: Creating index with UPPER
|
| Список | pgsql-general |
I am trying to create an index that is case insensitive (i.e. by making
the index on UPPER(col) and then selecting using WHERE col =
Upper('str')). However, the column is defined as a varchar, and I have
been unable to get it working (expects type text)
Thanks
Michael Fork - CCNA - MCP - A+
Network Support - Toledo Internet Access - Toledo Ohio
test=# CREATE TABLE foo (bar VARCHAR(5));
CREATE
test=# CREATE INDEX idx_foo_bar ON foo(UPPER(bar));
ERROR: DefineIndex: function 'upper(varchar)' does not exist
test=# CREATE INDEX idx_foo_bar ON foo(UPPER(bar::text));
ERROR: parser: parse error at or near "::"
test=# CREATE INDEX idx_foo_bar ON foo(UPPER(CAST(bar AS TEXT)));
ERROR: parser: parse error at or near "cast"
test=# CREATE INDEX idx_foo_bar ON foo(UPPER(TEXT(bar)));
ERROR: parser: parse error at or near "("
В списке pgsql-general по дате отправления: