pgadmin4 icon indicating copy to clipboard operation
pgadmin4 copied to clipboard

Unable to use pgAdmin with limited access (single database, no management database)

Open macnewbold opened this issue 1 year ago • 3 comments

I have a PostgreSQL database in a shared hosting environment, where my access is limited only to a single database. I am able to get connected to the server when listing that single database as the management database, but it immediately gives permission denied for view pg_settings. This makes some sense, because I don't appear to have access to pg_settings, but at the same time, it means I cannot use pgadmin at all. Other tools like psql or DbVisualizer allow me to connect, run queries, and see the things I have access to, even though they can't show me a list of all the databases on the server for example, since I don't have access to that. Am I doing something wrong or missing something that would allow me to use pgadmin?

To Reproduce

Steps to reproduce the behavior:

  1. Set up a database connection in pgadmin using a username and password that only have access to a single database, and no access to the real PostgreSQL management database.
  2. Try to connect
  3. See the error

Expected behavior

I'd love to be able to connect with pgadmin, see the one database I can access, the tables in it, etc., and be able to run queries.

Error message

permission denied for view pg_settings

Screenshots

image

Desktop (please complete the following information):

  • OS: Windows 10
  • Version: 8.8
  • Mode: Desktop

macnewbold avatar Jun 12 '24 17:06 macnewbold

For developers: Please check SELECT * FROM pg_show_all_settings(); SELECT * FROM pg_settings;

akshay-joshi avatar Jun 21 '24 10:06 akshay-joshi

For what it's worth, with the access I have to the server in question, I get an error for pg_settings:

SELECT * FROM pg_settings;
ERROR:  permission denied for view pg_settings

And I get 263 lines of results from SELECT * FROM pg_show_all_settings(); so it seems likely that if the latter gives the necessary info, it would be more robust than what is currently being attempted.

macnewbold avatar Jun 25 '24 19:06 macnewbold

Hi @macnewbold,

I tried to reproduce the issue but was unsuccessful. I followed up by creating a user and granting that user access to only one database.

Could you please share how you created the user and what permissions that user has?

pravesh-sharma avatar Aug 08 '24 07:08 pravesh-sharma

The access is configured and managed by a hosting service we use, so I don't have access to it. The errors I get are related to the fact that I have no access to the management database at all, so when pgadmin tries to find pg_settings, it cannot. With your test configuration, what do you get for SELECT * FROM pg_settings; ?

macnewbold avatar Aug 13 '24 16:08 macnewbold

Fixed and not reproducible, Verified on latest snapshot build. Mode :- Desktop OS - MacOS

RohitBhati8269 avatar Sep 16 '24 08:09 RohitBhati8269