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)
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)
--
Best,
Phil Alger
v4-0001-Add-pg_get_trigger_ddl-function.patch
Description: Binary data
