| From: | jian he <jian(dot)universality(at)gmail(dot)com> |
|---|---|
| To: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
| 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 06:06:09 |
| Message-ID: | CACJufxGKmoUPmwsEyNgsqguG_Z-HXDK6UvW5Ymb9CLg6MwBxVQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Sun, Oct 26, 2025 at 2:48 AM Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> wrote:
>
> 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
>
hi.
https://www.postgresql.org/docs/current/sql-createtrigger.html
says:
<<<
The name cannot be schema-qualified — the trigger inherits the schema of its
table.
<<<
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.
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Joel Jacobson | 2025-10-28 06:41:29 | Re: Optimize LISTEN/NOTIFY |
| Previous Message | Amit Kapila | 2025-10-28 06:04:15 | Re: Logical Replication of sequences |