Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement - Mailing list pgsql-hackers

From Marcos Pegoraro
Subject Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
Date
Msg-id CAB-JLwZ+MNJXMdzBOdeFHSS7N4X8M89tu-NWqGYzbg3wqyKaAw@mail.gmail.com
Whole thread
In response to Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement  (Philip Alger <paalger0@gmail.com>)
List pgsql-hackers
Em seg., 20 de jul. de 2026 às 13:01, Philip Alger <paalger0@gmail.com> escreveu:
I am not sure I understand. Could you provide an example, please? Thanks.

This patch [1] defines pg_get_table_ddl and you can see that it uses your function to describe the structure of a table.

+        Note that <literal>trigger</literal> and <literal>policy</literal>
+        are accepted in the vocabulary but currently produce no output;
+        they are reserved for future use when standalone
+        <function>pg_get_trigger_ddl</function> and
+        <function>pg_get_policy_ddl</function> helpers become available.  

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 

Therefore, all results will be displayed with or without the schema name, but the parts of the result that create the trigger will always have ?


regards
Marcos

pgsql-hackers by date:

Previous
From: Paul A Jungwirth
Date:
Subject: Re: Fix RETURNING side effects for FOR PORTION OF leftover rows
Next
From: Srinath Reddy Sadipiralla
Date:
Subject: Re: Fix "unexpected logical decoding status change" error; from concurrent logical decoding activation