Subject | Re: on delete cascade |
---|---|
Author | lobolo2000 |
Post date | 2006-06-03T08:16:28Z |
> It is impossible to end up with a record in the detail table withouta
> corresponding record in the master table with Firebird'sAbsolutely true.
> implementation.
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.