Why command \dt gives - no relations found?
I solved my problem by using double quote e.g \d "Table_name". Because my table name is capitalized like Foo, Bar. Hope that could help someones.
You might not be connected to the right database.
The first command \c DATABASE_NAME
, coming from the following comment on Reddit, did the trick for me.
Make sure you're connected to the correct database with \c . Using \l will list all databases regardless of which database you're connected to, but most commands are specific to the connected database.
Use \dt .* to list all tables with name matching in all schemas.
Assuming the table exists, it will tell you what schema it's in. Then you can query with SELECT * FROM .;.
If you want to avoid having to explicitly specify the schema name, make sure the schema that contains the table is in your path: SHOW search_path and SET search_path .
It is not a problem with your search_path
, it could be an issue with your schema permissions as described in the answer here. Check with \dn+
that the public
schema indicates permissions for the postgres
role, and if not, grant them with: GRANT ALL ON SCHEMA public TO public;