From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | Kevin Golding <KGolding(at)axessgroup(dot)com(dot)au>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: 'value too long' and before insert/update trigger |
Date: | 2017-08-24 11:44:03 |
Message-ID: | 30073.1503575043@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Wednesday, August 23, 2017, Kevin Golding <KGolding(at)axessgroup(dot)com(dot)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.
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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2017-08-24 11:56:52 | Re: DROP [TEMP] TABLE syntax, as reason why not? |
Previous Message | Francisco Olarte | 2017-08-24 10:58:04 | Re: DROP [TEMP] TABLE syntax, as reason why not? |