Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
jian he <jian.universality@gmail.com>
From: jian he <jian.universality@gmail.com>
To: Philip Alger <paalger0@gmail.com>
Cc: Jim Jones <jim.jones@uni-muenster.de>,
Andrew Dunstan <andrew@dunslane.net>, Cary Huang <cary.huang@highgo.ca>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-10-22T08:08:49Z
Lists: pgsql-hackers
On Sun, Oct 19, 2025 at 5:35 AM Philip Alger <paalger0@gmail.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?