Re: Case insensitive unique constraint

From: Vivek Khera <vivek(at)khera(dot)org>
To: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Case insensitive unique constraint
Date: 2005-07-15 14:29:06
Message-ID: CCEE10D2-1332-45C7-B6F0-642F1EFDFE6C@khera.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Jul 14, 2005, at 3:14 AM, Rob Brenart wrote:

> 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.
>
> Is there an easy way to go about this? Am I about to write my first
> server side function for postgresql?

create your unique index using the lower() function.

and don't steal threads to start a new one (ie, replying then just
changing the subject)

Vivek Khera, Ph.D.
+1-301-869-4449 x806

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dinesh Pandey 2005-07-15 14:38:50 Postgres for Fedora Core 2 OS ****************
Previous Message Tom Lane 2005-07-15 14:28:00 Re: How to create unique constraint on NULL columns