Wednesday 13 July 2016

postgreSQL Grant OR Revoke user Privileges

Cluster level:

  • Granted to a user during CREATE or later using ALTER USER
    These privileges are granted by superuser

Object Level:

  • Granted to user using GRANTcommand
  • These privileges allow a user to perform particular action on an database object, such as table, view, sequence etc.
  • Can be granted by Owner, superuser or someone who have been given permission to grant privilege (WITH GRANT OPTION)

Grant statement:

  • GRANT can be used for granting object level privileges to database users, groups or roles.
  • Privileges can be granted on a tablespace, database, schema, table, sequence, domain and function.
  • GRANT is also used to grant a role to a user.
Syntax:
-Type \h GRANT in edb-psqlterminal to view the entire syntax and available privileges that can be granted on different objects




Grant commad

Revoke statement:

  • REVOKE can be used for revoking object level privileges to database users, groups or roles.
  • Privileges can be revoked on a tablespace, database, schema, table, sequence, domain and function.
  • REVOKE [ GRANT OPTION FOR ] can be used to revoke only the grant option without revoking the actual privilege.

No comments:

Post a Comment