Hi,
Based on functional specification attached to DERBY-1330, I am working on having REVOKE REFERENCES privilege drop all the foreign key constraints dependent on that privilege.
I thought, this would involve going through SYSTABLEPERMS and SYSCOLPERMS in execute phase of of REVOKE statement to find all the privilege descriptors that would get impacted by the REVOKE REFERENCES statement. And then let the depenency manager find all the objects that depend on those privilege descriptors and send a REVOKE_PRIVILEGE to all those dependents. When the
ConstraintDescriptor.makeInvalid method receives REOVKE_PRIVILEGE, it can simply call DataDictionary().dropConstraintDescriptor(...). But this doesn't seem to do the magic and does not clean up everything (for instance, after the REVOKE REFERENCE statement is over, TableDescriptor which had foreign key defined on it still holds on to the foreign key).
I looked through alter table constant action to see what happens when a user issues a drop constraint foreignkeyname and it seems like there is lot more involved then simply calling the data dictionary to drop the constraint descriptor. In order to accomplish the same behavior, I am thinking that rather than calling just DataDictionary().dropConstraintDescriptor(...) method in the
ConstraintDescriptor.makeInvalid method, I should issue a sql statement "drop constraint foreignkeyname" inside ConstraintDescriptor.makeInvalid method and let it take care of all the necessary steps.
Does anyone have any thoughts on my approach?
Thanks,
Mamta
