Previous Topic

Next Topic

Revoking Grant Option

The grant statement grant option enables users other than the owner of an object to grant privileges on that object. For example:

grant select on employee_roster to mike with grant option;

enables mike to grant the select privilege (with or without grant option) to other users.

The grant option can be revoked without revoking the privilege with which it was granted. For example:

revoke grant option for select on employees from mike...

means that mike can still select data from the employees table, but cannot grant the select privilege to other users. (The grant option cannot be specified for database privileges.)

Previous Topic

Next Topic

Restrict versus Cascade

The restrict and cascade options specify how the DBMS Server handles dependent privileges. The cascade option directs the DBMS Server to revoke the specified privileges plus all privileges and objects that depend on the privileges being revoked. The restrict option directs the DBMS Server not to revoke the specified privilege if there are any dependent privileges or objects.

The owner of an object can grant privileges on that object to any user, group, or role. Privileges granted by users who do not own the object are dependent on the privileges granted with grant option by the owner.

For example, if user jerry owns the employees table, he can grant tom the ability to select data from the table and to enable other users to select data from the table:

grant select on employees to tom with grant option;

User tom can now enable another user to select data from the employees table:

grant select on employees to sylvester with grant option;

The grant tom conferred on sylvester is dependent on the grant the table's owner jerry conferred on tom. In addition, sylvester can enable other users to select data from the employees table.

If sylvester creates a view on the employees table, that view depends on the select privilege that tom granted to sylvester. For example:

create view njemps as select * from employees where state='New Jersey'

To remove his grant to tom, all grants tom can have issued, and any dependent objects, jerry must specify revoke...cascade:

revoke select on employees from tom cascade;

As a result of this statement, the select privilege granted by tom to sylvester is revoked, as are any select grants issued by sylvester to other users conferring select privilege for the employees table. The njemps view is destroyed.

To prevent dependent privileges from being revoked, jerry must specify revoke... restrict:

revoke select on employees from tom restrict;

Because there are dependent privileges (tom has granted select privilege on the employees table to sylvester), this revoke statement fails, and no privileges are revoked. The njemps view is not destroyed.

Note: If privileges are revoked from specific authorization IDs (users, groups, and roles) that were also granted to public, privileges and objects that depend on the grants persist (until the privileges are revoked from public).

The restrict and cascade parameters have the same effect whether revoking a specific privilege or the grant option for a specific privilege. In either case, restrict prevents the operation from occurring if there are dependent privileges, and cascade causes dependent privileges to be deleted. When revoking a grant option with cascade, all dependent privileges are revoked, not just the grant option portion of the dependent privileges.

Restrict or cascade must be specified when revoking privileges on tables, database procedures, or database events. When revoking database privileges, cascade, restrict, or grant option cannot be specified (because database privileges cannot be granted with grant option).


© 2007 Ingres Corporation. All rights reserved.