Re: Why does TRUNCATE require a special privilege? - Mailing list pgsql-general

From Tom Lane
Subject Re: Why does TRUNCATE require a special privilege?
Date
Msg-id 1725374.1768605280@sss.pgh.pa.us
Whole thread Raw
In response to Re: Why does TRUNCATE require a special privilege?  (Marcelo Fernandes <marcefern7@gmail.com>)
List pgsql-general
Marcelo Fernandes <marcefern7@gmail.com> writes:
> But from a roles/privilege framework perspective, why would you want to give
> certain users the DELETE privilege whereas others you want to give them
> only the TRUNCATE privilege?
> Are we saying to a user that "You need a different level of privilege because
> you are about to cause a MVCC-unsafe operation?".

Personally I think that's a plenty good enough reason ;-).
The very different locking level is another good reason.
TRUNCATE will block all other activity on the table, while
DELETE doesn't.

However, looking at our git history, it appears that TRUNCATE was
originally only permitted to the table owner.  The separate permission
bit was added (years later) so that the owner could grant out the
ability to others, without doing anything as non-backwards-compatible
as reinterpreting what operations a DELETE grant allows.

            regards, tom lane



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Why does TRUNCATE require a special privilege?
Next
From: Nicolas Seinlet
Date:
Subject: pg_trgm upgrade to 1.6 led to load average increase