0

I want to disable users from seeing the names of tables that he doesn't have access to. So the goal is to have several tables and several users that can make \dt and see only tables they have access to in single database. I tried accomplish this with

REVOKE ALL ON ALL TABLES IN SCHEMA pg_catalog FROM public, my_user;
CREATE SCHEMA my_schema;
GRANT ALL ON SCHEMA my_schema TO my_user;
GRANT ALL ON ALL TABLES IN SCHEMA my_schema TO my_user;
GRANT USAGE ON SCHEMA my_schema TO my_user;

And after creating table in my_schema my_user can access it and work with but can't list tables in this schema. Is there a better or another solution?

  • You disabled catalog access so \dt will not work. Remove the first REVOKE from your script. – filiprem Apr 3 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.