pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <smarlowe@g2switchworks.com>
To: Juliann Meyer <Julie.Meyer@noaa.gov>
Cc: pgsql-sql@postgresql.org
Subject: Re: how do I check for lower case
Date: Thu, 10 Aug 2006 16:57:58 -0500
Message-ID: <1155247078.20252.172.camel@state.g2switchworks.com> (raw)
In-Reply-To: <44DB97C5.9090307@noaa.gov>
References: <44DB97C5.9090307@noaa.gov>

On Thu, 2006-08-10 at 15:32, Juliann Meyer wrote:
> I have a table with a column, lets call it identifier, that is defined 
> as varchar(8) that should never contain lower case letters.  Its a large 
> table.  Is there a way to query the table to see if any values in this 
> column are lower case and to get a list out?  The user interface 
> application that users use prevents them from adding an entry in lower 
> case  now, but didn't in earlier version. 

You can also use the same upper / lower functions to make sure no lower
case stuff gets into the table at a later date:

test=> create table aaa (a text check (upper(a)=a));
CREATE TABLE
test=> insert into aaa (a) values ('ABC');
INSERT 2120799293 1
test=> insert into aaa (a) values ('ABC123');
INSERT 2120799294 1
test=> insert into aaa (a) values ('ABC12a3');
ERROR:  new row for relation "aaa" violates check constraint "aaa_a"

viola!



view thread (5+ messages)  latest in thread

Message-ID: <1155247078.20252.172.camel@state.g2switchworks.com>
Permalink:  ../1155247078.20252.172.camel@state.g2switchworks.com/
Also on:    postgresql.org/message-id/1155247078.20252.172.camel@state.g2switchworks.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: smarlowe@g2switchworks.com, Julie.Meyer@noaa.gov
  Subject: Re: how do I check for lower case
  In-Reply-To: <1155247078.20252.172.camel@state.g2switchworks.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox