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

Philip Alger <paalger0@gmail.com>

From: Philip Alger <paalger0@gmail.com>
To: Jim Jones <jim.jones@uni-muenster.de>
Cc: Andrew Dunstan <andrew@dunslane.net>, Cary Huang <cary.huang@highgo.ca>, jian he <jian.universality@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-10-17T19:07:49Z
Lists: pgsql-hackers
Hi Jim,

I am now wondering if introducing these new set of parameters to
> pg_get_triggerdef() would be a better solution that creating a new
> function.
>
> Doing so we keep it consistent with the other pg_get*def functions. What
> do you think?
>


The rationale behind it is here:
https://www.postgresql.org/message-id/945db7c5-be75-45bf-b55b-cb1e56f2e3e9%40dunslane.net

So, I am new to PG development, but I am hesitant to modify the existing
`pg_get_triggerdef` or its parameters. My concern is that users may
currently rely on its existing functionality and parameter structure, and
altering it could introduce breaking changes. I think the naming
`pg_get_trigger_ddl` is actually better than `triggerdef` because all the
current `pg_get*def` implementations accept OIDs. To my knowledge, the only
one that accepted an OIDs or a name is `pg_get_viewdef`, but the name
variant is now deprecated.

-- 
Best,
Phil Alger