Re: Case insensitive unique constraint - Mailing list pgsql-general

From Roman Neuhauser
Subject Re: Case insensitive unique constraint
Date
Msg-id 20050714080331.GA72206@isis.sigpipe.cz
Whole thread Raw
In response to Case insensitive unique constraint  (Rob Brenart <postgresql@oculardata.com>)
List pgsql-general
# postgresql@oculardata.com / 2005-07-14 02:14:16 -0500:
> I have a simple table to store account names... I want each name to be
> unique in a case insensitive manner... but I want the case the user
> enters to be remembered so I can't do a simple lower() on the data's way in.

    CREATE TABLE tbl (col VARCHAR(32) NOT NULL);
    CREATE UNIQUE INDEX ON tbl (UPPER(col));

--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

pgsql-general by date:

Previous
From: Klint Gore
Date:
Subject: Re: Case insensitive unique constraint
Next
From: Tino Wildenhain
Date:
Subject: Re: To Postgres or not