Home > Archive > PostgreSQL Administration > November 2006 > validating incoming string length...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author validating incoming string length...
Steve Holdoway

2006-11-14, 12:14 am

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 gett
ing the error 'ERROR: value too long for type character varying(255)' no matter what I try.

And yes, I inherited this!

Cheers,

Steve

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql
.org so that your
message can get through to the mailing list cleanly

Jerry Sievers

2006-11-14, 7:19 pm

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

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com