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

From: Philip Alger <paalger0(at)gmail(dot)com>
To: Marcos Pegoraro <marcos(at)f10(dot)com(dot)br>
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-08-03 15:15:39
Message-ID: CAPXBC8JPCDF233DifkAqM8t2hvYb1bKmiuO1pdpSyzk4mVVphA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
>
>
> So it results in something like
> select pg_get_table_ddl('sch1.x'::regclass, schema_qualified => false)
> CREATE TABLE x(...)
> ALTER TABLE x...
> CREATE CONSTRAINT yyy on x ...
> CREATE INDEX idx on x...
> CREATE TRIGGER ... --This one will use your function
>
>
In looking at this a bit more closer, over several days, in order to do
this, it would require a patch to pg_get_triggerdef_worker. At the same
time, I am not even sure that relying on the input of pg_get_table_ddl to
cascade parameters down the chain to other pg_get_*_ddl functions is what
is intended. My thought would be that if the table_ddl is to provide this
information, it would strip out the schema itself.

--
Best,
Phil Alger

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Rocker 2026-08-03 15:20:59 Re: [PATCH] Fix vacuum_delay_point happening inside lock
Previous Message Daniel Gustafsson 2026-08-03 15:01:47 Re: datachecksums: handle invalid and dropped databases during enable