public inbox for [email protected]
help / color / mirror / Atom feedFrom: Dominique Devienne <[email protected]>
To: Marcelo Fernandes <[email protected]>
Cc: [email protected]
Subject: Re: Why does TRUNCATE require a special privilege?
Date: Fri, 16 Jan 2026 11:32:41 +0100
Message-ID: <CAFCRh-9HTzAU7ia--Uad2-KnZv=zXeFaG0iT2ut0KXGEZhsHuw@mail.gmail.com> (raw)
In-Reply-To: <CAM2F1VNkovvL_56K_6OJiYU8toUdEG1Jk7ABRQ426Geh8LMB+g@mail.gmail.com>
References: <CAM2F1VNkovvL_56K_6OJiYU8toUdEG1Jk7ABRQ426Geh8LMB+g@mail.gmail.com>
On Fri, Jan 16, 2026 at 10:13 AM Marcelo Fernandes <[email protected]> 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
view thread (5+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Why does TRUNCATE require a special privilege?
In-Reply-To: <CAFCRh-9HTzAU7ia--Uad2-KnZv=zXeFaG0iT2ut0KXGEZhsHuw@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox