Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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

In response to

pgsql-novice by date

Next:From: Chad ThompsonDate: 2002-08-22 15:04:34
Subject: Re: Simple but slow
Previous:From: JDKDate: 2002-08-22 14:21:20
Subject: Enforcing Case

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group