Re: Case Insensitive CHECK CONSTRAINTs

From: Richard H <dev(at)archonet(dot)com>
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:02:35
Message-ID: 20010314.20023500@client.archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 3/14/01, 6:59:18 PM, Shaw Terwilliger <sterwill(at)sourcegear(dot)com> wrote
regarding [GENERAL] Case Insensitive CHECK CONSTRAINTs:

> I have a table with a TEXT field called "username". I'd like to retain
the
> case of the data stored here, but I'd like all comparisons to be done
without
> regard to case. Since all these accesses _should_ be done through
database
> 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
> alternate case "duplicate" records don't creep into the table. Any tips?

As long as you have a UNIQUE index on lower(username) that will prevent
"duplicate"s. The UNIQUE applies to the index entry not the column(s) the
index applies to.

- Richard Huxton

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jonas Lindholm 2001-03-14 20:07:35 Re: Re: Maximum size of one table
Previous Message Alfred Perlstein 2001-03-14 19:56:32 Re: Case Insensitive CHECK CONSTRAINTs