When creating a PostgreSQL database one can assign another role to be an owner of that database. What can the new owner do with this database? How is it compared to grants?
1 Answer
When an object is created, it is assigned an owner. The owner is normally the role that executed the creation statement. For most kinds of objects, the initial state is that only the owner (or a superuser) can do anything with the object. To allow other roles to use it, privileges must be granted.
The right to modify or destroy an object is always the privilege of the owner only.
-
7Is it ok to have postgres (superuser) be the owner of the database? Is it better to create new roles with limited rights to be the owner? Commented Aug 4, 2019 at 18:58
-
TLDR is it is ok and quite common but there are trade-offs, though really you should ask that as a stand-alone question.– xzillaCommented Oct 28, 2020 at 4:46
-
2Does owning a database give the owner access to all the tables in it, even if those are owned by other roles? Commented Apr 6, 2023 at 10:54