Re: Case Insensitive CHECK CONSTRAINTs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Shaw Terwilliger <sterwill(at)sourcegear(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Case Insensitive CHECK CONSTRAINTs
Date: 2001-03-14 20:09:54
Message-ID: 7463.984600594@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Shaw Terwilliger <sterwill(at)sourcegear(dot)com> writes:
> I have a table with a TEXT field called "username". I'd like to retain the=
> =20
> case of the data stored here, but I'd like all comparisons to be done witho=
> ut
> regard to case. Since all these accesses _should_ be done through database=
> =20
> functions, I can simply lower() the input values and compare. I also have
> an index created on lower(username), so lookups are quick.

> However, I'd also like to have some sort of table constraint to make sure=
> =20
> alternate case "duplicate" records don't creep into the table. Any tips?

Make that index be UNIQUE.

BTW, please don't send HTML-coded mail to the lists. It's a pain in the
neck to quote.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Orion Henry 2001-03-14 20:15:50 Re: Fast Inserts and Hardware Questions
Previous Message Jan Ploski 2001-03-14 20:09:33 Compiling 7.1 JDBC driver