dbcodeio / public

The Power of Databases, The Convenience of VS Code: All in One Place
29 stars 1 forks source link

Permission denied on rdsadmin when connecting to AWS RDS with limited user permissions #105

Closed daninfpj closed 2 weeks ago

daninfpj commented 2 weeks ago

I’m trying to connect to my DB and get this error:

Error getting databases for connection XXX, error: permission denied for database rdsadmin

As you see, my DB is hosted in AWS RDS and the user I’m using has permissions only on the DB I’m interested in but not on the rdsadmin DB.

Even though I set the specific Database that I want to access (and have permissions on) in the connection settings, it still tries to load all DBs and refuses to open the connection to that DB.

mikeburgh commented 2 weeks ago

Thanks for raising it, I don't have a Postgres RDS spun up at the moment to test, would you mind running the following SQL.. I am guessing the issue is trying to read the size/comment for the DB's you don't have access to:

SELECT oid, datname ,pg_database_size(oid), pg_catalog.shobj_description(oid, 'pg_database')
FROM pg_database 
WHERE datistemplate = false and datallowconn = true 
order by datname;

So assuming, the one above fails, this one should work:

SELECT oid, datname
FROM pg_database 
WHERE datistemplate = false and datallowconn = true 
order by datname;
mikeburgh commented 2 weeks ago

Was working on some other PG things today, so fired up an RDS instance to sort this out. The issue was trying to get the size of the databases, even though it was marked as being able to be connected to (datallowconn = true) it failed when trying to read the size.

I worked around if. If you try out the new version 1.4.4 it should work for you.

Let me know if you have any further issues.

daninfpj commented 5 days ago

Thanks! I tried the latest version and it works!