Michał Zubrzycki
Michał Zubrzycki

Reputation: 885

Postgresql role with no drop table permision

Is it possible to set role with access to one database, with all privileges except to drop tables?

Upvotes: 1

Views: 1263

Answers (1)

AdamKG
AdamKG

Reputation: 14091

Not really. If a user can issue CREATE TABLE, it can issue a DROP for that table as well. From the docs:

The right to drop an object, or to alter its definition in any way, is not treated as a grantable privilege; it is inherent in the owner, and cannot be granted or revoked.

And as noted by the CREATE TABLE docs:

The table will be owned by the user issuing the command.

There is no mechanism to allow a user to create tables that they do not own and therefore cannot drop.

Upvotes: 4

Related Questions