|Subject||Re: Issues with String Truncation error on insert (FB 2.1 64 bits windows server)|
> OLD/NEW pseudo-records have the same format as regular tableHi Dmitry
> records, inheriting the same length limits. And this is not a bug.
mmm, it does not make sanse to me, think it this way:
The field on table is say char 32
The insert is trying to insert a string of 40 characters, say "AAA..." repeated 40 times
What you are saying is the old and new records are char (32), and that is fine, as the trigger is assigning a string of say 31 characters into a char 32. Why is it failing?
the instruction on the trigger is:
new.mychar = substring(new.mychar from 1 for 31)
I don't see where the code is breaching the rules?
Unless Firebird is comparing the size of the original string posted in the insert instruction against the database, and that to me sounds like a bug.
--- In email@example.com, Dmitry Yemanov wrote:
> 16.01.2013 8:43, fabianchocron wrote:
> > We are trying to resolve an issue caused by the Application inserting a
> > string larger than the database field size. The planned solution was to
> > add a trigger before insert as follows:
> > new.string = substring(new.string from 1 for 100);
> This is not going to work.
> > For some reason that we do not understand the trigger is not working as
> > desired, and the insert fails with an arithmetic overflow or string
> > truncation error. Is is possible that Firebird 2.1 64 bits has a bug and
> > we may need to upgrade to resolve this issue?
> OLD/NEW pseudo-records have the same format as regular table records,
> inheriting the same length limits. And this is not a bug.