pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jerry Sievers <jerry@jerrysievers.com>
To: Steve Holdoway <steve@firetrust.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: validating incoming string length...
Date: 14 Nov 2006 11:06:41 -0500
Message-ID: <m37ixy9fn2.fsf@homie.jerrysievers.com> (raw)
In-Reply-To: <20061108113246.f910a989.steve@firetrust.org>
References: <20061108113246.f910a989.steve@firetrust.org>

Steve Holdoway <steve@firetrust.com> writes:

> I'm trying to write a pl/pgsql trigger to validate incoming data to
> an existing database. One of the fields is defined as character
> varying (255). Is there any way of catching over-length data on
> inserts and silently dropping them? At the moment, I'm getting the
> error 'ERROR: value too long for type character varying(255)' no
> matter what I try.

Sure.  Change the columns data type to text where you'll have no size
restriction and then let your trigger gun those illegal entries.

HTH

-- 
-------------------------------------------------------------------------------
Jerry Sievers   305 854-3001 (home)     Production Database Administrator
                305 321-1144 (mobil	WWW E-Commerce Consultant



view thread (2+ messages)

Message-ID: <m37ixy9fn2.fsf@homie.jerrysievers.com>
Permalink:  ../m37ixy9fn2.fsf@homie.jerrysievers.com/
Also on:    postgresql.org/message-id/m37ixy9fn2.fsf@homie.jerrysievers.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: jerry@jerrysievers.com, steve@firetrust.com
  Subject: Re: validating incoming string length...
  In-Reply-To: <m37ixy9fn2.fsf@homie.jerrysievers.com>
  References: <20061108113246.f910a989.steve@firetrust.org> <m37ixy9fn2.fsf@homie.jerrysievers.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