Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
| От | Marcos Pegoraro |
|---|---|
| Тема | Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement |
| Дата | |
| Msg-id | CAB-JLwa1bviUf_rzyoOp81xuMeXOwvh-hwP=U0ZBfz6Y+v+hSg@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement (Philip Alger <paalger0@gmail.com>) |
| Ответы |
Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
|
| Список | pgsql-hackers |
Em sáb., 18 de out. de 2025 às 15:23, Philip Alger <paalger0@gmail.com> escreveu:
There is no pretty option for this one, and the intent is for the user to be able to input a table and trigger to get the CREATE TRIGGER statement. Not sure how drop_first fits in here; we’re not dropping or creating triggers.
Sorry, sometimes my fingers don't obey my brain, I wrote one thing thinking another.
In a multi tenant world this feature will be cool for clone or sync ddl of two schemas. So, if I’m creating a new schema the way you did works but if both exists and I want to update some ddls of a schema, sometimes I have to DROP and CREATE or returned command should have CREATE OR REPLACE, depending on what ddl you are doing.
If you try to create a trigger but it already exists, you’ll get an exception, so you can emit a DROP IF EXISTS before CREATE of that trigger. For this that param drop_first would be.
I know you are doing only trigger ddl rigth now but I think we would have this kind of functions for tables, constraints, triggers, domains and so on, then all of them should work the same way, and for this a drop_first or if_exists would be good.
Regards
Marcos
В списке pgsql-hackers по дате отправления: