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: Philip Alger <paalger0@gmail.com>, jian he <jian.universality@gmail.com>
Cc: Andrew Dunstan <andrew@dunslane.net>, Cary Huang <cary.huang@highgo.ca>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-10-25T18:48:34Z
Lists: pgsql-hackers
Hi Phil, Hi Jian

On 23/10/2025 00:27, Philip Alger wrote:
> It might be advantageous to show a `trigger name cannot be schema
> qualified` error to the user. Therefore, I added the check and the tests
> on v8 attached.
> 
> postgres=# SELECT pg_get_trigger_ddl('main_table', 'public.modified_a');
> ERROR:  trigger name cannot be schema qualified

I'm not sure this is the way to go here. Why specifically check for a
schema qualified trigger if it cannot be created in the first place? The
current error message for "trigger not found" would IMHO suffice, e.g.

ERROR:  trigger "s.tr" for table "t" does not exist

Jian, is that what you had in mind?

Best, Jim