Implicitly created operator family not listed by pg_event_trigger_ddl_commands

From: LEMAIRE Leslie (Chargée de mission) - SG/SNUM/UNI/DRC <leslie(dot)lemaire(at)developpement-durable(dot)gouv(dot)fr>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Implicitly created operator family not listed by pg_event_trigger_ddl_commands
Date: 2022-05-02 11:27:20
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


I have an event trigger firing at command end on "CREATE OPERATOR
CLASS", "CREATE OPERATOR FAMILY" and every other creation command of
schema dependent objects.

As stated in the documentation [1], creating an operator class without
specifying the FAMILY option will create an operator family with the
same name as the new class if it doesn't already exist. In this case, my
event trigger is activated through the "CREATE OPERATOR CLASS" tag as
usual, but pg_event_trigger_ddl_commands() still returns only one row -
for the operator class creation. I would have expected it to list the
creation of the operator family as well.

Since event triggers don't catch implicit commands [2], the "CREATE
OPERATOR FAMILY" tag is useless here and the operator family creation is
never detected.

I observed this with PostgreSQL 14.2 (Windows 10, Visual C++ build 1914,
64-bit) and PostgreSQL 10.12 (Windows 10, Visual C++ build 1800,
64-bit), so it's likely not a version specific issue.

The documentation doesn't say much about pg_event_trigger_ddl_commands()
[3], but I would assume it's meant to be as exhaustive as possible,
hence this bug report. By comparison, with an event trigger firing at
command end on "CREATE TABLE" and a command such as "CREATE TABLE
my_table (id serial PRIMARY KEY)", pg_event_trigger_ddl_commands() would
return four rows, including the sequence creation and the index

Thanks in advance and sorry if I'm just missing something here.


[2] I don't think it's documented anywhere, but this seems to be a
consistant behaviour and it makes sense as long as
pg_event_trigger_ddl_commands() does the work.

Leslie Lemaire
Secrétariat général des ministères de la transition écologique, de la
cohésion des territoires et de la mer
Service du numérique


Browse pgsql-bugs by date

  From Date Subject
Next Message Miller, Mark - Xylem 2022-05-02 13:55:04 postgresql11-11.14-1PGDG.rhel8.x86_64.rpm reports incorrect name
Previous Message David G. Johnston 2022-05-02 02:22:43 Re: ERROR: type of parameter 1 (fruit2) does not match that when preparing the plan (fruit1)