Re: Case insensitive unique constraint

From: Roman Neuhauser <neuhauser(at)sigpipe(dot)cz>
To: Rob Brenart <postgresql(at)oculardata(dot)com>
Cc: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Case insensitive unique constraint
Date: 2005-07-14 08:03:31
Message-ID: 20050714080331.GA72206@isis.sigpipe.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

# postgresql(at)oculardata(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Klint Gore 2005-07-14 08:06:41 Re: Case insensitive unique constraint
Previous Message Gregory S. Williamson 2005-07-14 07:50:54 Re: Quotation marks in queries