Re: validating incoming string length... - Mailing list pgsql-admin

From Jerry Sievers
Subject Re: validating incoming string length...
Date
Msg-id m37ixy9fn2.fsf@homie.jerrysievers.com
Whole thread Raw
In response to validating incoming string length...  (Steve Holdoway <steve@firetrust.com>)
List pgsql-admin
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

pgsql-admin by date:

Previous
From: "Hans Guijt"
Date:
Subject: Finding out free space?
Next
From: "Andy Shellam (Mailing Lists)"
Date:
Subject: Re: Finding out free space?