[
http://issues.apache.org/jira/browse/DERBY-1612?page=comments#action_12425664 ]
Mamta A. Satoor commented on DERBY-1612:
----------------------------------------
Actually, initially, I had started out by factoring the code from
DropConstraintConstantAction.executeConstantAction so that invalidation
messages will be sent out. But after debugging, I found that invalidation
actions are only sent out for ReferencedKeyConstraintDescriptor (A
ReferencedConstraintDeescriptor is a primary key or a unique key that is
referenced by a foreign key). Since in Derby, at this point, only foreign key
constraints can have a privilege requirement, only a foreign key constraint
will receive a revoke invalidation action. Objects like
ReferencedConstraintDeescriptor can't reference any other table or routine and
hence can't have any privilege requirements and hence they will never receive a
revoke invalidation action. And that is why I didn't include the code for
sending DROP_CONSTRAINT action for revoke privilege code path.
Here is the existing invalidation code from the
DropConstraintConstantAction.executeConstantAction to help understand what is
happening
boolean cascadeOnRefKey = (cascade && conDesc instanceof
ReferencedKeyConstraintDescriptor);
if (!cascadeOnRefKey)
{
dm.invalidateFor(conDesc, DependencyManager.DROP_CONSTRAINT, lcc);
}
As one can see from the code above, DROP_CONSTRAINT invalidation is sent only
if the ConstraintDescriptor is an instanceof ReferencedKeyConstraintDescriptor.
In case of revoke invalidations, the ConstraintDescriptor will never be
instanceof ReferencedKeyConstraintDescriptor, instead, they will always be an
instanceof ForeignKeyConstraintDescriptor and hence even if I include the code
for invalidation in the revoke privilege code path, the invalidation will never
get sent.
> As per the functional spec attached to DERBY-1330, a constraint should be
> dropped when a privilege required by the constraint is revoked.
> -----------------------------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-1612
> URL: http://issues.apache.org/jira/browse/DERBY-1612
> Project: Derby
> Issue Type: New Feature
> Components: SQL
> Affects Versions: 10.2.0.0
> Reporter: Mamta A. Satoor
> Assigned To: Mamta A. Satoor
> Fix For: 10.2.0.0
>
> Attachments: DERBY1612_V1_diff_DropConstraintOnRevoke.txt,
> DERBY1612_V1_stat_DropConstraintOnRevoke.txt
>
>
> A constraint tracks its privileges requirements using Derby's Dependency
> Manager. If any one of those required privileges are revoked, the constraint
> should be dropped automatically.
> I am just creating a new jira entry here so it is easier to track sub items
> of DERBY-1330. Will link this Jira entry to DERBY-1330.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira