Re: Case insensitive unique constraint

From: "John D(dot) Burger" <john(at)mitre(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-15 14:06:29
Message-ID: 7b4b04932c6486a1b1a92c2c3bdba754@mitre.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ropel 2005-07-15 14:20:52 Re: how to insert '\\' in postgres database using java
Previous Message ketan shah 2005-07-15 13:49:17 how to insert '\\' in postgres database using java