Re: Should TRUNCATE fire DDL triggers

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Hari Krishna Sunder <hari(dot)db(dot)pg(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Should TRUNCATE fire DDL triggers
Date: 2025-07-09 04:23:27
Message-ID: CAKFQuwYH4ndD3jJvaHEqE6apSD=nS+TumopF1a8VoaFCmZDJWg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tuesday, July 8, 2025, Hari Krishna Sunder <hari(dot)db(dot)pg(at)gmail(dot)com> wrote:

> 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?
>

Neither…classification systems are often imperfect…but it sure quacks like
DML to my ears. I’d probably remove the term “DDL” from that first link
and avoid the grey area. Listing the two commands suffices.

>
> 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?
>
>
Seems worthy of consideration regardless of how one answers the prior
question; for much the same reason.

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-07-09 04:29:17 Re: [PATCH] Add support for displaying database service in psql prompt
Previous Message Hari Krishna Sunder 2025-07-09 04:06:48 Should TRUNCATE fire DDL triggers