As a user with admin privileges in postgres, I can psql database_name
and then invoke \dt
to see a list of relations. As the same (unix) user, I execute psql -h localhost -U non-privileged-user table_name
, and \dt
reports NO relations found.
The only host
entries in pg_hba.conf
are of the form host analytics all 127.0.0.1/32 md5
(where 127.0.0.1 is the first entry).
Where are the relations? Why are they not visible to the alternate user. What schema tables should I look in to debug. Also, note that grant select on table_name to non-privileged-user
works just fine.
Best Answer
What you see typically happens when the non-privileged user doesn't have schema level privileges. In this case, they cannot list the objects inside the given schema - with the command you tried. See the below example:
See what the documentation says:
\dt
does the latter, namely queriespg_class
andpg_namespace
to find matching objects. Apparently, when the schema name is not specified, the system wants to hide objects from view.