16

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 1

12

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.

http://www.postgresql.org/docs/current/static/ddl-priv.html

3
  • 7
    Is 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?
    – Joseph K.
    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.
    – xzilla
    Oct 28, 2020 at 4:46
  • 2
    Does owning a database give the owner access to all the tables in it, even if those are owned by other roles? Apr 6, 2023 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.