Re: Enforcing Case

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: JDK <adahma(at)starport(dot)org>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Enforcing Case
Date: 2002-08-22 14:53:23
Message-ID: 20020822145323.GA415@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Thu, Aug 22, 2002 at 07:21:20 -0700,
JDK <adahma(at)starport(dot)org> wrote:
> I have a small single table database that multiple people enter data
> into, and I do some reporting from. I would like to be able to
> force everything to upper case because currently it seems that ABCD
> or abcd or AbCd are all treated as unique, and it cause me problems
> in reporting, not to mention it makes me nuts seeing the data in the
> tables all inconsistent like that.
>
> How would I force everything to upper case?

You can use a check constraint. Something like
col1 text constraint upper_only check (col1 ~ '^[A-Z]$')

Note this ONLY allows uppercase. If you just want to ban lowercase
then you need to change the constraint (but you probably want more than
this).

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Chad Thompson 2002-08-22 15:04:34 Re: Simple but slow
Previous Message JDK 2002-08-22 14:21:20 Enforcing Case