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-07-17 12:47:45
Message-ID: CAPXBC8KVpwSLc1j8wTmVsnnYdqBm3kH0cn43JZr6HFMZ88OFXw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Hackers,

Updated the pg_get_trigger_ddl() patch to align with the other pg_get_*_ddl
functions that are committed. I moved the function out of the relutils.c
file to the ddlutils.c file and moved the tests to TAP tests as well. In
this patch, pretty printing is introduced and functional, similar to the
other DDL functions.

Overall, it's quite a change. Previously I used pg_get_triggerdef to
capture the DDL output. However, this proved to be difficult since there
isn't the dame pretty functionality that exists with other functions like
pg_get_viewdef. Therefore, instead of trying to add pretty-printing
capability to the triggerdef function or creating a similar function that
duplicates code, I take the output of triggerdef as a string and parse it
across multiple lines to achieve the pretty-printing output.

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

Attachment Content-Type Size
v9-0001-Add-pg_get_trigger_ddl-function.patch application/octet-stream 17.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Westermann (DWE) 2026-07-17 12:47:47 Deprecation warnings on Rocky 10.2 with current dev branch
Previous Message Antonin Houska 2026-07-17 12:20:17 Re: Unexpected changes of CurrentResourceOwner and CurrentMemoryContext