Skip site navigation (1) Skip section navigation (2)

Re: Use of !~* to keep a varchar column UNIQUE case-insensitive

From: "Don Morrison" <donmorrison(at)gmail(dot)com>
To: "Sean Davis" <sdavis2(at)mail(dot)nih(dot)gov>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Use of !~* to keep a varchar column UNIQUE case-insensitive
Date: 2006-08-18 16:49:06
Message-ID: aee6519f0608180949t61d7590fwab5eb81a54d36ffb@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
> You can define your index to be unique on a function of the column.  As an
> example:
>
> create table testtable (
>    name varchar(40) not NULL
> );
> create unique index my_case_insensitive_index on testtable(lower(name));

That'll work, thanks Sean!

In response to

pgsql-novice by date

Next:From: Don MorrisonDate: 2006-08-18 17:52:28
Subject: Re: Use of !~* to keep a varchar column UNIQUE case-insensitive
Previous:From: Tom LaneDate: 2006-08-18 16:48:03
Subject: Re: Use of !~* to keep a varchar column UNIQUE case-insensitive

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group