db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamta Satoor" <msat...@gmail.com>
Subject Re: Revoke REFERENCES privilege and drop foreign key constraint
Date Wed, 12 Jul 2006 15:42:31 GMT
Yes, that is what I had originally tried, which is to have the
ConstraintDescriptor.makeInvalid call following when it receives
REVOKE_PRIVILEGE action
getDataDictionary().dropConstraintDescriptor(getTableDescriptor(), this,
lcc.getTransactionExecute());

But looks like that is not sufficient to have all the other data structures
clean themselves off of the constraint descriptor. For instance, after the
call above, TableDescriptor still had the conglomerate of the constraint's
backing index attached to it.

thanks,
Mamta


On 7/12/06, Daniel John Debrunner <djd@apache.org> wrote:
>
> Mamta Satoor wrote:
> > Hi,
> >
> > I spent some time prototyping revoke privilege for foreign key
> constraint
> > based on my proposal earlier in this thread.
> > I added following code to ConstraintDescriptor.makeInvalid
> >
> >  if (action == DependencyManager.REVOKE_PRIVILEGE)
> >  {
> >   PreparedStatement ps = lcc.prepareInternalStatement("alter table "+
> > table.getQualifiedName() + " drop constraint " + constraintName);
> >
> >   ResultSet rs = ps.execute(lcc, true, 0L);
> >   rs.close();
> >   rs.finish();
> >   return;
> >
> >  }
> >
> > This works fine as long as the user who issued the revoke references
> > privilege is a dba or owner of the table on which foreign key constraint
> is
> > defined. But for any other user, the revoke references privilege barfs
> > saying that user can't perform the operation in that schema.
>
> I would have exepected the ConstraintDescriptor to drop itself directly
> using the DataDictionary apis, rather than go back through SQL. Would
> that be possible?
>
> Dan.
>
>
>

Mime
View raw message