Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement

From: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: Philip Alger <paalger0(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Cary Huang <cary(dot)huang(at)highgo(dot)ca>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
Date: 2025-10-28 10:46:41
Message-ID: a44b18bf-c8ea-47d5-b951-857857c67c98@uni-muenster.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2025-10-28 10:49:35 Re: SQL:2011 Application Time Update & Delete
Previous Message Shinya Kato 2025-10-28 10:33:00 Re: Add wal_fpi_bytes_[un]compressed to pg_stat_wal