Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Philip Alger <paalger0(at)gmail(dot)com>
Cc: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Cary Huang <cary(dot)huang(at)highgo(dot)ca>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
Date: 2025-10-22 08:08:49
Message-ID: CACJufxErnfjjxYnNvWaEVu2nb_7XG7zgQZiHhzwNX8e89S=CvA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Oct 19, 2025 at 5:35 AM Philip Alger <paalger0(at)gmail(dot)com> wrote:
>
> Attached is v7. Moved the `initStringInfo` as suggested and reran tests.
>
hi.

https://www.postgresql.org/docs/current/sql-createtrigger.html
the parameter section:
>>>>
The name to give the new trigger. This must be distinct from the name of any
other trigger for the same table. The name cannot be schema-qualified — the
trigger inherits the schema of its table
>>>>

doc said trigger name can not be schema-qualified,
we can not do:
CREATE TRIGGER public.modified_a BEFORE UPDATE OF a ON main_table
FOR EACH ROW WHEN (OLD.a <> NEW.a) EXECUTE PROCEDURE trigger_func('modified_a');

+ text *trgName = PG_GETARG_TEXT_PP(1);
+ Oid trgOid;
+ List *nameList;
+ char *schemaName;
+ char *objName;
+
+
+ /* Parse the trigger name to handle quoted identifiers */
+ nameList = textToQualifiedNameList(trgName);
+ DeconstructQualifiedName(nameList, &schemaName, &objName);

So the above ``textToQualifiedNameList(trgName);`` part is wrong?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2025-10-22 08:30:41 RE: POC: enable logical decoding when wal_level = 'replica' without a server restart
Previous Message Shinya Kato 2025-10-22 08:04:58 Add wal_fpi_bytes_[un]compressed to pg_stat_wal