Subject Re: [firebird-support] Re: on delete cascade
Author Ann W. Harrison
lobolo2000 wrote:
>
> But the question is: should we be able to execute statements while the
> detail records have no master record, or in more general terms when
> referential integrity is violated though temporarily?

Probably not. As I suggested earlier, we are working to clean up
the remnants of "row by row" behavior in favor of "verb by verb"
constraint checking. Part of that will (eventually) include
moving pre-operation triggers on multi-table update verbs - like
cascading updates and deletes - so all pre-operation triggers
fire before any operation and all post-operation triggers fire
after all operations. We're not their yet.
>
> Example: Consider having a flag field in the master record that
> allows/prevents deletion of detail records. In the before delete
> trigger of the detail table, the master record's flag is checked to
> decide whether to allow the deletion or throw an exception.

That's a belt and suspenders approach that won't work with
cascading operations because the pre-operation trigger will
fire before any changes are made, causing the operation to
fail - hung by its own suspenders, to stretch a metaphor.



Regards,


Ann