Subject Re: on delete cascade
Author lobolo2000
> It is impossible to end up with a record in the detail table without
a
> corresponding record in the master table with Firebird's
> implementation.

Absolutely true.

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?

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. If a
delete of the master record is done (triggering a cascaded delete of
detail records) the detail records would find out that they are
orphans. Of course this can be easily circumvented with a before
delete trigger on the master table, but this is besides the point.