Is it possible in PostgreSQL to grant all privileges on a schema of a database other than the one I'm currently connected to (and without using the \c command to switch first)?
For example, I'm connected as user postgres to the database postgres. Now I want to grant someuser all privileges on schema public:
GRANT ALL ON SCHEMA public TO someuser;
This executes successfully, but applies to schema public in the postgres database. What I really want is to apply the privileges on schema public of the other database. Something like this:
GRANT ALL ON SCHEMA <other>.public TO someuser;
When connecting to the database server, a client must specify the database name in its connection request. It is not possible to access more than one database per connection.See postgresql.org/docs/current/manage-ag-overview.html