[ACCEPTED]-Storing a case insensitive varchar in PostgreSQL-case-insensitive

Accepted answer
Score: 23

From the docs

CREATE UNIQUE INDEX lower_title_idx ON films ((lower(title)));

0

Score: 4

If the tables are not yet populated you 9 may consider simply converting to a standard 8 upper or lower case prior to doing any insertions 7 and making the field a primary key (or just 6 have a unique constraint). If the user 5 want to see his userid in the case he specified 4 this could be another column in the database.

Update:Based 3 on the updated tags I would still suggest 2 the solution I have proposed as being less 1 dependent on a particular DBMS.

Score: 4

Do note that PostgreSQL 8.4 (currently beta) will 1 have a case-insensitive text type.

More Related questions