User REVIEW for PostgreSQL

Sometimes we need a database user only for review (read-only) purposes, this user used just for view some data or all data in a database, not for insert, delete and other CRUD activities in a database.

So if you want to create a REVIEW user in PostgreSQL, you have to grant access for SELECT and EXECUTE in a schema or database, and you have to grant access that user into schema itself. These script will help you out to create review user in PostgreSQL :

CREATE USER review WITH PASSWORD 'password_review';

GRANT SELECT ON ALL TABLES IN SCHEMA schema_name TO review;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA schema_name TO review;
GRANT USAGE ON SCHEMA schema_name TO review;

Leave a Reply