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

Re: before trigger doesn't, on insert of too long data

From: Neil Conway <neilc(at)samurai(dot)com>
To: Thomas Erskine <thomas(dot)erskine(at)sympatico(dot)ca>
Cc: pgsql-bugs(at)postgresql(dot)org, Anil Nair <anil(at)talentmap(dot)com>
Subject: Re: before trigger doesn't, on insert of too long data
Date: 2003-11-10 19:35:09
Message-ID: 871xsgyq36.fsf@mailbox.samurai.com (view raw or flat)
Thread:
Lists: pgsql-bugs
Thomas Erskine <thomas(dot)erskine(at)sympatico(dot)ca> writes:
> A before trigger doesn't always fire.  If a column being inserted into is
> too small for the incoming data, psql complains:
>      ERROR:  value too long for type ...
> without giving the trigger procedure a chance to deal with it.

I believe this is a feature, not a bug: a CHAR(4) field should never,
ever contain > 4 characters. Whether there is a trigger that is yet to
be processed is not relevant.

I'd suggest changing the type of the column to be TEXT, or similar
(which should be just as efficient CHAR(4)).

-Neil


In response to

Responses

pgsql-bugs by date

Next:From: Neil ConwayDate: 2003-11-10 19:37:51
Subject: Re: COPY and sequences
Previous:From: Gaetano MendolaDate: 2003-11-10 00:24:46
Subject: Re: Autocomplete <TAB> on Postgres7.4beta5 not working?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group