"Johann Zuschlag" <zuschlag(at)online(dot)de> writes:
>> The value is being coerced into the type before your trigger
>> runs to be put into the values you're testing and it fails
>> at that point.
> Is there a solution for such a problem?
Don't use varchar(n) --- use text. You can still enforce the length
limit you want inside the trigger, if you really want a length limit
at all.
regards, tom lane