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

From Andreas Seltenreich
Subject Re: Case insensitive unique constraint
Date
Msg-id 8764vdizav.fsf@gate450.dyndns.org
Whole thread Raw
In response to Case insensitive unique constraint  (Rob Brenart <postgresql@oculardata.com>)
List 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
--

pgsql-general by date:

Previous
From: Tino Wildenhain
Date:
Subject: Re: To Postgres or not
Next
From: Harry Mantheakis
Date:
Subject: Re: Japanese words not distinguished