Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
| От | Philip Alger | 
|---|---|
| Тема | Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement | 
| Дата | |
| Msg-id | CAPXBC8+a_pENV6payEQxHEOkYG8O_JdfgOgZ_0qyVAUx3FXm4Q@mail.gmail.com обсуждение исходный текст  | 
		
| Ответ на | Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement (Andrew Dunstan <andrew@dunslane.net>) | 
| Ответы | 
                	
            		Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
            		
            		 | 
		
| Список | pgsql-hackers | 
Thank you Andrew.
I think you should change the documentation.
Changed.
I've updated v4, attached here. One thing I noted while testing was that pg_get_triggerdef does not put the statement terminator (;) at the end of the printed statement. 
                                                                 pg_get_triggerdef                                                                  
----------------------------------------------------------------------------------------------------------------------------------------------------
CREATE TRIGGER modified_a BEFORE UPDATE OF a ON public.main_table FOR EACH ROW WHEN ((old.a <> new.a)) EXECUTE FUNCTION trigger_func('modified_a')
(1 row)
----------------------------------------------------------------------------------------------------------------------------------------------------
CREATE TRIGGER modified_a BEFORE UPDATE OF a ON public.main_table FOR EACH ROW WHEN ((old.a <> new.a)) EXECUTE FUNCTION trigger_func('modified_a')
(1 row)
I accounted for that in v4.
SELECT pg_get_trigger_ddl('main_table', 'modified_a');
pg_get_trigger_ddl
-----------------------------------------------------------------------------------------------------------------------------------------------------
CREATE TRIGGER modified_a BEFORE UPDATE OF a ON public.main_table FOR EACH ROW WHEN ((old.a <> new.a)) EXECUTE FUNCTION trigger_func('modified_a');
(1 row)
pg_get_trigger_ddl
-----------------------------------------------------------------------------------------------------------------------------------------------------
CREATE TRIGGER modified_a BEFORE UPDATE OF a ON public.main_table FOR EACH ROW WHEN ((old.a <> new.a)) EXECUTE FUNCTION trigger_func('modified_a');
(1 row)
Best, 
Phil Alger
Вложения
В списке pgsql-hackers по дате отправления: