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

From: Philip Alger <paalger0(at)gmail(dot)com>
To: Soumya S Murali <soumyamurali(dot)work(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
Date: 2026-05-05 22:10:10
Message-ID: CAPXBC8+tVf=VHwA0zuzsMhvQdw8Vue9bK4pFNDDHSuWbPVzF7A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> In support of this, I have tried testing after making a small change
> in the function pg_get_trigger_ddl() in ruleutils.c:
>
> Instead of this:
> /*Parse the trigger name to handle quoted identifiers */
> nameList = textToQualifiedNameList(trgName);
> if (list_length(nameList) != 1)
> ereport(ERROR,
> (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
> errmsg("trigger name cannot be schema qualified")));
> DeconstructQualifiedName(nameList, &schemaName, &objName);
>
>
Thanks for taking a look Soumya.

I believe these DDL functions now live in ddlutils.c and include a new
parameter for adding a "pretty" flag is required. I am in the middle of
developing a patch for that, but I took your fix into consideration.

> Do: objName = text_to_cstring(trgName); to treat the trigger name
>

I think this makes sense.

I also will need to make a few adjustments to get the pretty printing
functionality working. Since my patch essentially borrows from
pg_get_triggerdef_worker, it will need some work.

--
Best,
Phil Alger
EDB: https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message SATYANARAYANA NARLAPURAM 2026-05-06 00:58:02 Re: Fix HAVING-to-WHERE pushdown with nondeterministic collations
Previous Message Paul A Jungwirth 2026-05-05 21:50:05 Re: FOR PORTION OF does not recompute GENERATED STORED columns that depend on the range column