Re: [GENERAL] 'value too long' and before insert/update trigger - Mailing list pgsql-general

From David G. Johnston
Subject Re: [GENERAL] 'value too long' and before insert/update trigger
Date
Msg-id CAKFQuwZAieGuQa2OTunzv7dtei9ztKiSeEJ1muPjZTEA58xJbw@mail.gmail.com
Whole thread Raw
In response to [GENERAL] 'value too long' and before insert/update trigger  (Kevin Golding <KGolding@AxessGroup.com.au>)
Responses Re: [GENERAL] 'value too long' and before insert/update trigger  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Wednesday, August 23, 2017, Kevin Golding <KGolding@axessgroup.com.au> 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.  I suspect changing this property of the system is unlikely though I agree that I too have sometimes wished that a trigger could be used to make invalid data, for a given type, valid.

Some hackish use of views, and triggers thereon, may provide an avenue to gradual migration.

David J.

pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: [GENERAL] 'value too long' and before insert/update trigger
Next
From: Vincenzo Romano
Date:
Subject: Re: [GENERAL] DROP [TEMP] TABLE syntax, as reason why not?