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

From: Philip Alger <paalger0(at)gmail(dot)com>
To: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
Cc: jian he <jian(dot)universality(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 19:01:58
Message-ID: CAPXBC8KeUmicR-F9SU90+yNAStKN2J6nUhaxBtQRxRpbLw+eZQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

> > 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
>

The extra check is for the user experience because the function accepts
`text`. A user could theoretically pass in `public.my_trigger`,
`"MySchema".my_trigger`, etc. as a string. This function won't allow it and
actually educates the user that it's wrong behavior. In v7, as Jian rightly
stated, it would ignore any schema a user put in, which would be wrong to
do.

> 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.
>

I am not sure what you mean here. Are you suggesting keep the check in v7
with `trigger name \"%s\" for table \"%s\" does not exist"` and remove the
extra check in v8?

--
Best,
Phil Alger

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2025-10-28 19:10:18 Re: Feature: psql - display current search_path in prompt
Previous Message Masahiko Sawada 2025-10-28 18:53:26 Re: Question about InvalidatePossiblyObsoleteSlot()