This article is half-done without your Comment! *** Please share your thoughts via Comment ***
Sharing one of the important articles for the PostgreSQL Professionals.
In PostgreSQL, when you create a new user without specifying any grant or rule, by default it the user can access all databases.
Postgres internally provides a PUBLIC grant to the newly created user.
So here, Database security is one of primary concern for us.
You can refer this article to create, read only user in PostgreSQL.
If you want to prevent the user from accessing all the databases, use below REVOKE script.
1 |
REVOKE CONNECT ON DATABASE database_name FROM PUBLIC; |
My advice is to always create the customized database role for application and read-only user.
After executing revoke command, you can grant CONNECT to your Database Role.
1 |
GRANT CONNECT ON DATABASE database_name TO role_name; |