RAbraham
RAbraham

Reputation: 6314

Create Postgres User with admin rights just for one database

How can I create a postgres user who has admin access only to one database but cannot inspect or interfere with other databases in the postgres instance? The use case is I'm creating a multitenant application

EDIT: Added more constraints

Upvotes: 2

Views: 2799

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 246493

That's fairly trivial:

CREATE DATABASE newdb;
GRANT CREATE ON DATABASE newdb TO newdba;

Add pg_hba.conf entries to allow newdba to connect to newdb only.

Upvotes: 4

Related Questions