Subject Re: [firebird-support] Instead-Of-Tigger on view causes infinite loop (probably in the engine!)
Author Ann W. Harrison
Andrea Sansottera wrote:

> There could be any reason which causes the engine to confuse
> "Ingredient" with "IngredientView", only when updating 2 or more rows?
> Inserting into "IngredientView" obviously would couse an infinite
> recursion in the trigger chain.

Ah. Excellent guess. If the new row you store into Ingredient is
visible in the view, you'd get the behavior you're seeing. For example,
this statement stores an infinite number of records in Firebird,
assuming there's a record in table A:

insert into a (f1, f2, f3)
select (f1 + 1, f2 + 1, f3 + 1) from a


It's a bug of long standing - since the first published SQL standard.
Before there was a SQL standard, it was a quirk. The behavior has been
part of InterBase/Firebird since 1985. There's probably some way to
cheat by adding a field, visible through the view, that you can test and
change so the trigger can distinguish between view changes and native
table changes.

Regards,


Ann