How to grant permissions on all tables to a user in PostgreSQL

In this article, we will see how to grant permissions on all tables to a user in PostgreSQL.

Syntax:

GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO user_name;

Examples:

1. First grant CONNECT to database using below syntax.
Continue reading How to grant permissions on all tables to a user in PostgreSQL

Grant and Revoke Privileges in PostgreSQL

In this video, we are going to see how to Grant and Revoke Privileges in PostgreSQL Server.

What is Grant?
GRANT — define access privileges.
What is REVOKE?
REVOKE — remove access privileges.

The possible privileges are:

SELECT, INSERT,UPDATE,DELETE,TRUNCATE,REFERENCES,TRIGGER,CREATE,CONNECT,TEMPORARY(TEMP),EXECUTE,USAGE, ALL PRIVILEGES.

Part1: GRANT Examples:

1. Grant SELECT privileges on table ‘customer’ to user ‘anil’
Continue reading Grant and Revoke Privileges in PostgreSQL

How to check list of privileges on a table in PostgreSQL

In this tutorials, we have explained how to check list of privileges on a table in PostgreSQL. We can get the privileges by using SQL statement and meta-command.

1 . SQL Statement to get list of permissions on a table.

SELECT grantee, privilege_type FROM information_schema.role_table_grants WHERE table_name='customer'

Continue reading How to check list of privileges on a table in PostgreSQL