Subject Re: [ib-support] BUG IN FIREBIRD
Author Ann W. Harrison
At 02:13 PM 10/16/2001 +0000, banzatto@... wrote:

>i have a trigger before insert with code below :
>
>if (EXISTS
> (SELECT A.DIVISAO1,A.DIVISAO2,A.DIVISAO3,A.DIVISAO4
> FROM AREA A
> WHERE (A.DIVISAO1 = NEW.DIVISAO1)
> AND (A.DIVISAO2 = NEW.DIVISAO2)
> AND (A.DIVISAO3 = NEW.DIVISAO3)
> AND (A.DIVISAO4 = NEW.DIVISAO4)))
> THEN
> EXCEPTION CHAVE_DUPLICADA;
>
>when it´s dispared the code is changed to
>
>SELECT COUNT(*) FROM RDB$DATABASE
> WHERE (EXISTS
> (SELECT A.DIVISAO1,A.DIVISAO2,A.DIVISAO3,A.DIVISAO4
> FROM AREA A
> WHERE (A.DIVISAO1 = 'A' )
> AND (A.DIVISAO2 = 'A' )
> AND (A.DIVISAO3 = cast(null as char) )
> AND (A.DIVISAO4 = cast(null as char) )))
>
>the fields with <null> are changed for cast(null as char) don´t
>executing the exception. i analized this code with IB expert
>debug the trigger. what´s the problem ???

That's a good question. Are you absolutely sure you didn't
redefine the trigger? Could they actually be two different
triggers? I've had a look at the code that parses and compiles
triggers, and it's not nearly smart enough to transform the first
trigger into the second ... and probably not venal enough either.


Regards,

Ann
www.ibphoenix.com
We have answers.