Should TRUNCATE fire DDL triggers

From: Hari Krishna Sunder <hari(dot)db(dot)pg(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Should TRUNCATE fire DDL triggers
Date: 2025-07-09 04:06:48
Message-ID: CAAeiqZ3z+KWSPD4mMGiah22dE8ST2Gtwtu3uAVFf43qpiOVFRg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

First of all, is TRUNCATE a DDL or a DML? This
<https://www.postgresql.org/docs/current/mvcc-caveats.html> doc refers to
it as a DDL, whereas other docs like this
<https://www.postgresql.org/docs/17/runtime-config-logging.html#GUC-LOG-STATEMENT>
and this
<https://www.postgresql.org/docs/17/hot-standby.html#HOT-STANDBY-USERS> treat
it as a DML, so which one is it?

A lot of other SQL databases treat TRUNCATE as a DDL, so assuming that is
true, can we add it to the command tags supported by "ddl_command_start"
and "ddl_command_end" triggers?

---
Hari Krishna Sunder

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2025-07-09 04:23:27 Re: Should TRUNCATE fire DDL triggers
Previous Message Peter Geoghegan 2025-07-09 03:43:17 Re: Can can I make an injection point wait occur no more than once?