Reputation: 81
I have a users table, I see it in pgadmin4, but for some reason when I use psql and try to run list users, I get the following error:
Relation “users” does not exist.
Upvotes: 7
Views: 28379
Reputation: 945
You need to put table name in quotes. And, it is case sensitive:
SELECT * FROM "Users";
Upvotes: 12
Reputation: 62
none of the solution mentioned here worked for me untill i wrote the query thus
SELECT * FROM public."Users";
This worked for me.
Upvotes: 1
Reputation: 39
I've add new Schema (and remove there my user table) in database so my request was
SELECT "role" FROM "user" ...
But now should be with schema name
SELECT "role" FROM "schemaName"."user" ...
Upvotes: 1
Reputation: 7
In case of automated test, setting a delay after migrations do the job:
setTimeout(() => {
// queries
}, 1000);
Maybe it is the delay for the database to be done.
The automated test is multithread in my case.
Upvotes: -5
Reputation: 288
This will happen if the psql user does not have schema level privileges. This error message can be misleading.
To solve this issue, try connecting using psql with an admin user and run:
1.
GRANT USAGE ON SCHEMA public TO <non-admin-user>;
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO <non-admin-user>;
Upvotes: 12