8

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.

5 Answers 5

13

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>;
Sign up to request clarification or add additional context in comments.

Comments

12

You need to put table name in quotes. And, it is case sensitive:

SELECT * FROM "Users";

2 Comments

Adding quotes if there is a capital letter
Thanks bro, you saved me! Kudos for you!
1

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" ...

Comments

1

none of the solution mentioned here worked for me untill i wrote the query thus

SELECT * FROM public."Users";

This worked for me.

Comments

-4

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.