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

From John D. Burger
Subject Re: Case insensitive unique constraint
Date
Msg-id 7b4b04932c6486a1b1a92c2c3bdba754@mitre.org
Whole thread Raw
In response to Re: Case insensitive unique constraint  (Rob Brenart <postgresql@oculardata.com>)
List pgsql-general
>>  create unique index tbl_iname_idx on tbl (lower(name_field))

By the way, in case it wasn't obvious, this has a nice side-benefit.
Namely, PG will use that index for caseless lookups, so you can do
this:

   select * from tbl where lower(name_field) = lower('John');

very efficiently.

- John D. Burger
   MITRE



pgsql-general by date:

Previous
From: Wesley
Date:
Subject: problem after restoring a backup database on a different PC
Next
From: Ropel
Date:
Subject: Re: how to insert '\\' in postgres database using java