Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
Philip Alger <paalger0@gmail.com>
From: Philip Alger <paalger0@gmail.com>
To: Jim Jones <jim.jones@uni-muenster.de>
Cc: jian he <jian.universality@gmail.com>,
Andrew Dunstan <andrew@dunslane.net>, Cary Huang <cary.huang@highgo.ca>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-10-28T19:01:58Z
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