Subject Re: [Firebird-Architect] Re: NOT UPDATABLE fields
Author Dmitry Yemanov
"Ann W. Harrison" <aharrison@...> wrote:
>
> Unh, maybe I'm just having a really bad, day, but I don't see what we
> get for extending the trigger syntax that we don't have already.
>
> > So the trigger can look like this:
> >
> > CREATE TRIGGER bla ON myTable AFTER UPDATE
> > WHEN
> > old.protectedCol1 IS DISTINCT FROM new.protectedCol1
> > OR
> > old.protectedCol2 IS DISTINCT FROM new.protectedCol2
> > AS BEGIN
> > RAISE myException;
> > END
>
> CREATE TRIGGER blah ON mytable AFTER UPDATE
> AS BEGIN
> IF ((old.protectedCol1 IS DISTINCT FROM new.protectedCol1)
> OR (old.protectedCol2 IS DISTINCT FROM new.protectedCol2))
> THEN RAISE myException;
> END

1) No need to copy the record to/from OLD/NEW
2) No need to execute a trigger at all (nested looper call and savepoints
creation are avoided)

And more SQL99 compatibility as a bonus ;-) Hereby, I support Roman's
suggestion.


Dmitry