Subject Re: [Firebird-Architect] Re: View updates and upward compatibility
Author Ann W. Harrison
At 02:03 PM 10/19/2004, Adrian Allende wrote:

>Please, do not remove updatable views (triggers in views).

We're not talking about removing the ability to use triggers
to emulate updates on non-updateable views. What's being
discussed is a very specific issue.

Currently, simple views of a single table are naturally
updateable. So for example if you have a table t with
fields f1, f2, and f3 and create a view of t like this

create view v (f1, f2, f3)
as select (f1, f2, f3) from t where f1 > 10

a statement like this:

insert into v (f1, f2, f3) values (12, 13, 'whatever');

inserts a row into t with the values 12, 13, and 'whatever'.

If you add a trigger to the view that, for example, logs the
insert to a separate table, Firebird 1 and Firebird 1.5 insert
a new row in table t and a new row in the log table.

In Firebird2, adding the trigger stops the 'natural' update,
so only the log record will be stored. Adding an apparently
irrelevant trigger has the side effect of stopping the primary
insert - without raising an error.