Re: Case insensitive unique constraint

From: Rob Brenart <postgresql(at)oculardata(dot)com>
To: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Case insensitive unique constraint
Date: 2005-07-14 21:58:36
Message-ID: 42D6E00C.8080508@oculardata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Klint Gore wrote:

>On Thu, 14 Jul 2005 02:14:16 -0500, Rob Brenart <postgresql(at)oculardata(dot)com> 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?
>>
>>
>
>how about
> create unique index tbl_iname_idx on tbl (lower(name_field))
>
>klint.
>
>
Not suprising when you get the same advice from a handful of people, but
this is exactly what I needed, thanks all.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-07-14 22:05:51 Re: Stopping Postgres
Previous Message David Mitchell 2005-07-14 21:53:30 Re: Stopping Postgres