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

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

Re: force varchar column to be lowercase


  • From: Andreas Wenk <a(dot)wenk(at)netzmeister-st-pauli(dot)de>
  • To: Kevin Kempter <kevink(at)consistentstate(dot)com>
  • Cc: pgsql-admin(at)postgresql(dot)org
  • Subject: Re: force varchar column to be lowercase
  • Date: Tue, 28 Jul 2009 12:15:03 +0200
  • Message-id: <4A6ECFA7.30005@netzmeister-st-pauli.de> <text/plain>

Kevin Kempter schrieb:
Can I use a check constraint, or something other than a function to force a column to be lowercase only?


Thx in advance

try to use regexp in your CHECK CONSTRAINT:

CHECK (column::bpchar ~ '^[a-z]+$'::bpchar::text)

Cheers

Andy



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group