Re: Enforcing Case - Mailing list pgsql-novice

From Bruno Wolff III
Subject Re: Enforcing Case
Date
Msg-id 20020822145323.GA415@wolff.to
Whole thread Raw
In response to Enforcing Case  (JDK <adahma@starport.org>)
List pgsql-novice
On Thu, Aug 22, 2002 at 07:21:20 -0700,
  JDK <adahma@starport.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).

pgsql-novice by date:

Previous
From: JDK
Date:
Subject: Enforcing Case
Next
From: "Chad Thompson"
Date:
Subject: Re: Simple but slow