Comment by sfifs
11 hours ago
A bit off topic but the one thing I've never been able to figure out with Postgres easily & reliably is what magic incantations allow a user account full access to a specific database but not to others, particularly in cases of managed postgres offered by cloud providers. `GRANT ALL PRIVILEGES` never seems to work.
Having to look up and spend time fixing permissions every time itself makes using Postgres for simple uses difficult for me but if you're using it ad hoc, any tips?
Isn't it something like GRANT ALL ON DATABASE foo TO USER bar
Grant operates on objects that already exist. They probably want ALTER DEFAULT PRIVILEGES or maybe just a superuser. The Postgres docs are actually really really good. https://www.postgresql.org/docs/current/sql-alterdefaultpriv... https://www.postgresql.org/docs/current/role-attributes.html
I ran into this once... I think there's something about the grant not working on new objects or being one level too low? I tended to solve those problems by granting ownership of the db itself.
99% of the time I've used Postgres it has been one user and one database. The one time I needed to create and configure a separate user with different permissions I remember it being thoroughly confusing and I think the DBA ended up doing it.
One of the best features of Postgres is the documentation. I recommend starting there.
Just let Claude fuck it up for you and learn from its mistakes.