22.4. Granting and Revoking Privileges (metastore.mgrant, metastore.mrevoke) #

Required privileges:

You can grant and revoke privileges on pgpro_metastore objects using the following commands:

  SELECT metastore.mgrant(privilege, object_type, object_name, role, with_grant_option true or false);
  SELECT metastore.mrevoke(privilege, object_type, object_name, role, grant_option_only true or false);

Where:

Example 22.5. 

  • Grant the role user1 the INSERT privilege on the hits analytical table:

      SELECT metastore.mgrant('INSERT','TABLE','hits','user1');
    
  • Revoke from the role user1 the INSERT privilege on the hits analytical table:

      SELECT metastore.mrevoke('INSERT','TABLE','hits','user1');
    

Alternatively, you can grant or revoke privileges directly on proxy tables of pgpro_metastore objects using the following queries:

  GRANT privilege ON metastore.proxy_table_name TO role [WITH GRANT OPTION];
  REVOKE [GRANT OPTION FOR] privilege ON metastore.proxy_table_name FROM role;

Where:

Example 22.6. 

  • Grant the role user1 the INSERT privilege on the proxy table associated with the hits analytical table:

      GRANT INSERT ON metastore.t_hits_00001 TO user1;
    
  • Revoke from the role user1 the INSERT privilege on the proxy table associated with the hits analytical table:

      REVOKE INSERT ON metastore.t_hits_00001 FROM user1;