K
K
Kirill Petrov2021-10-01 10:50:29
PostgreSQL
Kirill Petrov, 2021-10-01 10:50:29

How to hide from the list of databases in Postgres that are not available to the user?

Greetings. How to make it so that users can't see bases they can't connect to in the list?
I will have it arranged so that each user can work with only one database whose name corresponds to his login.
In addition to the user manager, who just does the administration of databases, users and access rights.
6156bca47b8d0442671714.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
Xtensive, 2021-10-07
@Xtensive

If you do not get into the depths of the postgres system database - no way.
By default, the user can see all other database instances on the cluster (in Postgres terms), even if he does not have rights to connect to other databases than his own.
A quick search yields such and such answers on SO.
In the second option, they offer to take away the rights to Select from the Information Schema in the system database from a simple user. Unfortunately, such actions can lead to unpredictable consequences.
As an alternative, you can place user data in the same database, but in different schemas, thus it is easier to manage access, because one user will only see their schema and their data.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question