REVOKE FROM SHARE Statement

Description

The REVOKE FROM SHARE statement is used to revoke the permissions of a shared table or view. By executing this statement, you can revoke other users or roles' access to the shared object.

Syntax Format

REVOKE [PERMISSIONS] ON {TABLE table_name | VIEW view_name} FROM SHARE share_name;

Parameter Description

  • PERMISSIONS: Specifies the permissions to be revoked. Optional values are select (for querying data) and read metadata (for viewing the metadata of a table or view).
  • TABLE table_name: Specifies the name of the table for which the permissions are to be revoked.
  • VIEW view_name: Specifies the name of the view for which the permissions are to be revoked.
  • share_name: Specifies the name of the share to be operated on.

Example

  1. Revoke a user's query permission and metadata viewing permission on a shared table:
    REVOKE select, read metadata ON TABLE share_demo_table FROM SHARE share_demo;
2. Only revoke the user's query permission for the shared view:
REVOKE select ON VIEW share_demo_view FROM SHARE share_demo;
  1. Revoking a user's metadata viewing permissions for the shared table, but retaining query permissions:
    REVOKE read metadata ON TABLE share_demo_table FROM SHARE share_demo;

Notes

  • Before executing the REVOKE FROM SHARE statement, please ensure that you have sufficient permissions to revoke the permissions of the shared object.
  • Users or roles whose permissions have been revoked will no longer be able to access the specified tables or views.
  • If you need to re-grant permissions, you can use the GRANT statement.

With the above content, you can better understand and use the REVOKE FROM SHARE statement to manage the permissions of shared objects.