I am using PostgreSQL 9.0.3 on RedHat. The database contains two schemas, public
and wh
. I created a new role called django
. I want this user to use the wh
schema as it's default.
Following the manual, I did:
ALTER USER django SET SEARCH_PATH TO wh, public;
This appears to work:
SHOW SEARCH_PATH;
search_path
-------------
wh, public
However, if I then do a \dt
, only tables from the public schema are displayed. In the manual, changing the search path should have an immediate effect, and I should be able to access wh
tables without a prefix, but this is not the case. Logging in and out preserves the changes to search_path
but does not show any change of behavior.
What am I missing?
GRANT
might solve your problem:
GRANT USAGE ON SCHEMA wh TO django;
(Or GRANT USAGE ...
to any role which has django as a (direct or indirect) member.)
(Or GRANT ALL ...
if that is what you want.)
Setting the search_path
instructs Postgres to look for objects in the listed schemas. It does not grant permission to see what's there. If "django" does not have the necessary privileges, \dt
must not (and does not) show that information.
On the other hand, if you have already tried as superuser (as per your comment on the previous suggestion), then this might not be it ...