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

From Philip Alger
Subject Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
Date
Msg-id CAPXBC8JmfwzUrfN9jCxuX75dn-v8vPq+dvH0cPyPMXGjzBmKnA@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement  (jian he <jian.universality@gmail.com>)
Responses Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
List pgsql-hackers


On Mon, Oct 13, 2025 at 9:28 PM jian he <jian.universality@gmail.com> wrote:

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?

Thank you for checking that. Short answer: no. 

Please see v2. The latest version should take care of the (null) relation issue now, since it is checking if the OID exists for the table. I've included a test for that as well. It should return a clearer error if the relation does not exist. 

--
Best, 
Phil Alger
Attachment

pgsql-hackers by date:

Previous
From: Alexander Lakhin
Date:
Subject: Re: IO in wrong state on riscv64
Next
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: Patch for migration of the pg_commit_ts directory