| From: | Josef Šimánek <retro(at)ballgag(dot)cz> |
|---|---|
| To: | Philip Alger <paalger0(at)gmail(dot)com> |
| Cc: | jian he <jian(dot)universality(at)gmail(dot)com>, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Cary Huang <cary(dot)huang(at)highgo(dot)ca>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, josef(dot)simanek(at)gmail(dot)com |
| Subject: | Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement |
| Date: | 2025-11-02 21:12:12 |
| Message-ID: | CABb55oQemkQjw9ffsUz-+TXuDPePA0+szgM3BjFa-c37-_fJNg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
ne 2. 11. 2025 v 22:08 odesílatel Philip Alger <paalger0(at)gmail(dot)com> napsal:
>
>
>>
>>>> doc said trigger name can not be schema-qualified,
>>>> we can not do:
>>>> CREATE TRIGGER public.modified_a BEFORE UPDATE OF a ON main_table
>>>> FOR EACH ROW WHEN (OLD.a <> NEW.a) EXECUTE PROCEDURE trigger_func('modified_a');
>>>
>>>
>>>>
>>>> + nameList = textToQualifiedNameList(trgName);
>>>>
>>
>> I am wondering if adding an error message if someone inserted a schema name would be advantageous?
>
>
> 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.
Would it make sense to rename trigger related variables to "trig"
prefix instead of "trg" as is done in other functions in the same file
(for example in function pg_get_triggerdef)?
> postgres=# SELECT pg_get_trigger_ddl('main_table', 'public.modified_a');
> ERROR: trigger name cannot be schema qualified
>
> Thanks.
>
> --
> Best,
> Phil Alger
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Josef Šimánek | 2025-11-02 21:15:00 | Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement |
| Previous Message | Tom Lane | 2025-11-02 20:56:49 | Re: Making jsonb_agg() faster |