Subject Re: [firebird-support] Re: Recursive Triggers
Author Ann W. Harrison
sdbeames wrote:
>
> I was hoping to do <disable self> <update table> <enable self>
> all within the trigger.
>
Disabling a trigger is a metadata operation that affects all users of
the database. Because it's a metadata operation, it doesn't take effect
until it's been committed, which you can't do in a trigger. Try this
instead, using a table called recursion_check to hold the state:

as begin
if not exists (select 1 from recursion_check
where user = CURRENT_USER
and recursion = 'true')
then begin
insert into recursion_check (user, recursion)
values (CURRENT_USER, 'true');
<do whatever>
delete from recursion_check
where user = CURRENT_USER
and recursion = 'true')

end
end


Regards,


Ann