Search Postgresql Archives

Re: 'value too long' and before insert/update trigger

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"David G. Johnston" <david.g.johnston@xxxxxxxxx> writes:
> On Wednesday, August 23, 2017, Kevin Golding <KGolding@xxxxxxxxxxxxxxxxx>
> wrote:
>> Presumably the length validation is being done before the trigger is run.
>> Is there some way this could be changed so the trigger happens first?

> The input tuple passed into the trigger is a valid record of the same type
> as the table to which it is attached.  This means that while table
> constraints are not enforced all column values must already be valid for
> the defined column type.

Right, that's why this isn't likely to change.  You could replace the
datatype-related limit with a CHECK constraint, and then it'd be possible
for a BEFORE trigger to modify the value to make it compliant before the
constraint is checked.

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux