Re: Case insensitive unique constraint

From: Andreas Seltenreich <andreas+pg(at)gate450(dot)dyndns(dot)org>
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:09:44
Message-ID: 8764vdizav.fsf@gate450.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Rob Brenart schrob:

> 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?

Would creating an unique index on an expression be easy enough?
E.g. create unique index idx_foo_unique_nocase on foo ((lower(bar)));

> Am I about to write my first server side function for postgresql?

I'm afraid not :-)

regards,
Andreas
--

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Harry Mantheakis 2005-07-14 08:19:49 Re: Japanese words not distinguished
Previous Message Tino Wildenhain 2005-07-14 08:08:41 Re: To Postgres or not