Subject Deleting one way but not another (design help needed)
Author dmarmur2002
Hi ye all!

I have a table B that has a FK constraint to table A on A's ID. B has
a primary key on ID plus another field so that several records can
exist in B for one in A. Simple enough. The FK update and delete
rules are both CASCADE.

B, however has a BEFORE DELETE trigger that prevents the user from
deleting some specific records. I want theese records to be
an "untoched" group.

When a record in A is deleted, the "group-idioma" is no longer of
importance so I want the user to be able to use the cascading
delete (in spite of the BEFORE DELETE trigger i B, that is).

It seems dangerous and unorthodox, if even possible, to deactivate and
activate the trigger on B from the BEFORE DELETE trigger in table A.

It's also not possible to delete the records in B from a trigger in A
since there's the trigger in B (BTW it throws an exception).... :)

How do I go about? Is there some way to sense in B's trigger how the
deletion is made (this would be the best)? Through a user-specific
global or something that I could turn on in a before delete trigger
of A and then turn off in an after delete trigger? Should I use a
table with a per-user flag?

Thank you for pointerns and comments.