Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
Jim Jones <jim.jones@uni-muenster.de>
From: Jim Jones <jim.jones@uni-muenster.de>
To: jian he <jian.universality@gmail.com>
Cc: Philip Alger <paalger0@gmail.com>, Andrew Dunstan <andrew@dunslane.net>,
Cary Huang <cary.huang@highgo.ca>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-10-28T10:46:41Z
Lists: pgsql-hackers
Hi Jian
On 28/10/2025 07:06, jian he wrote:
> SELECT pg_get_trigger_ddl('main_table', 'public.modified_a');
> should error out, I think.
> but V7 will not error out, instead it will ignore text "public" and print out
> DDL for the trigger name as "modified_a" which is not what I expected, so I
> raised the question.
>
> The error message can be different, but it should error out.
+1
> I am fine with v8.
> ERROR: trigger name cannot be schema qualified
>
> I’m fine with changing it to the other error message:
> ERROR: trigger name \"%s\" for table \"%s\" does not exist
I also think that raising an ERROR is the right approach here. My point
was rather the *extra check* for a schema qualified trigger name.
Letting it fail with the existing error message "trigger name \"%s\" for
table \"%s\" does not exist" down the road should be enough.
Best, Jim