Re: Why does TRUNCATE require a special privilege?

From: Dominique Devienne <ddevienne(at)gmail(dot)com>
To: Marcelo Fernandes <marcefern7(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Why does TRUNCATE require a special privilege?
Date: 2026-01-16 10:32:41
Message-ID: CAFCRh-9HTzAU7ia--Uad2-KnZv=zXeFaG0iT2ut0KXGEZhsHuw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jan 16, 2026 at 10:13 AM Marcelo Fernandes <marcefern7(at)gmail(dot)com> wrote:
> From the documentation:
> > TRUNCATE quickly removes all rows from a set of tables. It has the same
> > effect as an unqualified DELETE on each table, but since it does not actually
> > scan the tables it is faster.
> > (...)
> > You must have the TRUNCATE privilege on a table to truncate it.
>
> Granted that TRUNCATE and DELETE are different operations under the hood, but
> why would the TRUNCATE operation require its own specific privilege rather than
> say, use the same privilege as the DELETE operation?

It's kinda obvious, when you read the notes.

1) Not MVCC-safe.
2) Do not fire TRIGGERs, thus breaking data-integrity
3) "Viral" in the presence of FKs, i.e. related tables must also be TRUNCATEd

Just these 3 are HUGE departures from a DELETE. --DD

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2026-01-16 16:46:56 Re: Why does TRUNCATE require a special privilege?
Previous Message Marcelo Fernandes 2026-01-16 09:13:09 Why does TRUNCATE require a special privilege?