Обсуждение: validating incoming string length...

Поиск
Список
Период
Сортировка

validating incoming string length...

От
Steve Holdoway
Дата:
I'm trying to write a pl/pgsql trigger to validate incoming data to an existing database. One of the fields is defined
ascharacter 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. 

And yes, I inherited this!

Cheers,

Steve

Re: validating incoming string length...

От
Jerry Sievers
Дата:
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