I have the following problem:
1) I have one master table with a primary key.
2) In addition I have *several* slave tables, all refering to a primary
key in the master table (no two slave tables refer to the same master key)
I wan't to make sure that no keys in the master table are unreferred, that
is:
* If a slave row is deleted, I wan't to delete the corresponding master
row too. Also if the slave row should be modified as a result of some
cascading effect, I wan't all unreferred master keys to be deleted.
* I have tried to create a trigger, that ensures the above. But this is,
for some reason, not getting fired if the deletion of a slave row is a
result of a foreign key cascading effect. So this is only of limited use.
How can I keep my master table clean - preventing any "leaks"?
For the curios: The master table is a dictionary table and all the slave
tables contains all (dynamically created) content. Hereby all content
can be localised easily.