From: | jian he <jian(dot)universality(at)gmail(dot)com> |
---|---|
To: | Philip Alger <paalger0(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement |
Date: | 2025-10-14 02:28:10 |
Message-ID: | CACJufxHQSnfEDY_iidjyU8Rz5OuOjjKkfhXRTqxyAxsX7qJ7eQ@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Oct 14, 2025 at 9:59 AM Philip Alger <paalger0(at)gmail(dot)com> wrote:
>
> Hello,
>
> I am submitting patch as a part of a larger Retail DDL functions project described by Andrew Dunstan here: https://www.postgresql.org/message-id/945db7c5-be75-45bf-b55b-cb1e56f2e3e9%40dunslane.net
>
> This patch creates a function pg_get_trigger_ddl, designed to retrieve the full DDL statement for a trigger. Users can obtain the DDL by providing the table and trigger names, like the following:
>
> SELECT pg_get_trigger_ddl('my_table_name', 'my_trigger_name');
>
> While pg_get_triggerdef currently provides a similar SQL statement, it requires the trigger's OID, making it less convenient. This function simplifies this by allowing direct input of the table and trigger names, eliminating the need to find the OID beforehand. I opted not to include the "pretty" formatting capability that pg_get_triggerdef offers.
>
> This patch includes documentation, comments, and regression tests, all of which have run successfully.
>
I just did a quick test.
src1=# SELECT pg_get_trigger_ddl(2, 'foo_trigger');
ERROR: trigger "foo_trigger" for table "(null)" does not exist
src1=# SELECT pg_get_trigger_ddl(0, 'foo_trigger');
ERROR: trigger "foo_trigger" for table "(null)" does not exist
this error message is use facing, is the above error message what we expected?
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2025-10-14 02:44:45 | Re: [PING] [PATCH v2] parallel pg_restore: avoid disk seeks when jumping short distance forward |
Previous Message | Jeff Davis | 2025-10-14 02:23:36 | Re: Clarification on Role Access Rights to Table Indexes |