DBA Hub

šŸ“‹Steps in this guide1/2

ERROR: permission denied for schema in postgres - DBACLASS DBACLASS

PROBLEM: We have granted select privilege on one table of a schema to another user. Even after that the user was getting permission denied error while selecting data. — Privilege was granted like this PRIMDB=# grant all privileges on table SCOTT.SERVER_LOAD_INFO to prim_user; GRANT Now connect to prim_user and run the select statement: psql -d […]

postgresql configurationintermediate
by PostgreSQL
29 views
1

PROBLEM:

We have granted select privilege on one table of a schema to another user. Even after that the user was getting permission denied error while selecting data. — Privilege was granted like this Now connect to prim_user and run the select statement:

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
PRIMDB=# grant all privileges on table SCOTT.SERVER_LOAD_INFO to prim_user;
GRANT

psql -d PRIMDB -U prim_user

PRIMDB=> select * from SCOTT.SERVER_LOAD_INFO;
ERROR:  permission denied for schema SCOTT
LINE 1: select * from SCOTT.SERVER_LOAD_INFO;
2

SOLUTION:

We need to provide usage privilege on that schema to other user also. > As per postgres note: By default, users cannot access any objects in schemas they do not own. To allow that, the owner of the schema must grant the USAGE privilege on the schema. As per postgres note: By default, users cannot access any objects in schemas they do not own. To allow that, the owner of the schema must grant the USAGE privilege on the schema.

Code/Command (click line numbers to comment):

1
2
3
4
NSMD2SIT=# grant usage on schema SCOTT to prim_user;


-- Now run the select statment:

Comments (0)

Please to add comments

No comments yet. Be the first to comment!