Creating index with UPPER

From: Michael Fork <mfork(at)toledolink(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Creating index with UPPER
Date: 2000-12-12 20:15:55
Message-ID: Pine.BSI.4.21.0012121507260.10040-100000@glass.toledolink.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 "("

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adam Lang 2000-12-12 20:22:49 Re: manuals
Previous Message Robert B. Easter 2000-12-12 20:12:52 Re: SQL 92 standard