Re: Case insensitive uniqueness on column?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: doug <douglaskorchinski(at)nospam(dot)shaw(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Case insensitive uniqueness on column?
Date: 2003-05-25 02:05:29
Message-ID: 200305250205.h4P25Tk22950@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

doug wrote:
> Can this be done in postgres?

You mean:

Case insensitive uniqueness on column?

Yes. You have to create a functional index on the column using
lower(col), like:

CREATE UNIQUE INDEX uq on tab (lower(col))

I think that will work.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2003-05-25 02:06:16 Re: PostgreSQL Performance on OpenBSD
Previous Message Nigel J. Andrews 2003-05-25 01:32:21 Re: implicit abort harmful?