Re: Should REINDEX be listed under DDL?

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Michael Paquier <michael(at)paquier(dot)xyz>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Should REINDEX be listed under DDL?
Date: 2023-12-04 07:53:56
Message-ID: fc543657c4dbcee018b9e305b75a5784391db4fa.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 2023-12-04 at 14:26 +0900, Michael Paquier wrote:
> On a recent thread about adding support for event triggers with
> REINDEX, a change has been proposed to make REINDEX queries reflect in
> the logs under the DDL category:
> https://www.postgresql.org/message-id/ZW0ltJXJ2Aigvizl%40paquier.xyz
>
> REINDEX being classified as LOGSTMT_ALL comes from 893632be4e17 back
> in 2006, and the code does not know what to do about it. Doing the
> change would be as simple as that:
> case T_ReindexStmt:
> - lev = LOGSTMT_ALL; /* should this be DDL? */
> + lev = LOGSTMT_DDL;
>
> REINDEX is philosophically a maintenance command and a Postgres
> extension not in the SQL standard, so it does not really qualify as a
> DDL because it does not do in object definitions, so we could just
> delete this comment. Or could it be more useful to consider that as a
> special case and report it as a DDL, impacting log_statements?

It should be qualified just like CREATE INDEX.
Both are not covered by the standard, which does not mention indexes,
since they are an "implementation detail".

I think that it is pretty clear that CREATE INDEX should be considered
DDL, since it defines (creates) and object. The same should apply to
REINDEX.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Haotian Chen 2023-12-04 07:58:11 Re: Dumped SQL failed to execute with ERROR "GROUP BY position -1 is not in select list"
Previous Message Dmitry Koval 2023-12-04 07:52:06 Re: Add SPLIT PARTITION/MERGE PARTITIONS commands