Re: Should TRUNCATE fire DDL triggers - Mailing list pgsql-hackers

From Laurenz Albe
Subject Re: Should TRUNCATE fire DDL triggers
Date
Msg-id 18466b927e99910b78d98c5cbe252f8eff66d72e.camel@cybertec.at
Whole thread Raw
In response to Re: Should TRUNCATE fire DDL triggers  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-hackers
On Tue, 2025-07-08 at 21:23 -0700, David G. Johnston wrote:
> On Tuesday, July 8, 2025, Hari Krishna Sunder <hari.db.pg@gmail.com> wrote:
> > First of all, is TRUNCATE a DDL or a DML? This doc refers to it as a DDL,
> > whereas other docs like this and this 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.

I agree with that.
 
> > 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.

I disagree here.  There are regular ON TRUNCATE triggers on tables, so I don't
see the need.  You can define a trigger with the same trigger function on
several tables.

Yours,
Laurenz Albe



pgsql-hackers by date:

Previous
From: "sundayjiang(蒋浩天)"
Date:
Subject: 回复:[Internet]Re: [PATCH] Prevent replacement of a function if it's used in an index expression and is not IMMUTABLE
Next
From: Cédric Villemain
Date:
Subject: Re: Adding basic NUMA awareness - Preliminary feedback and outline for an extensible approach