I am using postgresql. I have created a user and grant access on db. I want user can only see granted schema objects and rest database/schema objects can't watchable. Please guide me.
Asked
Active
Viewed 44 times
0
-
http://stackoverflow.com/questions/760210/how-do-you-create-a-read-only-user-in-postgresql?rq=1 – Sep 02 '15 at 12:41
1 Answers
0
You need to alter the user and set the search path.
ALTER USER foo SET search_path TO '$newschema,pg_catalog';
Note that in order to get a proper backup of globals such as this you have to use pg_dumpall -g, not pg_dump. Obviously a base backup will have them as well.

Joshua D. Drake
- 1,026
- 5
- 6
-
alter user ali set search_path TO 'usman'; still not working and ali able to see other schema objects. – Irfan Ahmad Sep 02 '15 at 15:58
-
You can not completely remove other schema visibility on its own. You need search_path plus a series of GRANT/REVOKE statements. – Joshua D. Drake Sep 04 '15 at 18:45