Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement - Mailing list pgsql-hackers

From Philip Alger
Subject Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
Date
Msg-id CAPXBC8+a_pENV6payEQxHEOkYG8O_JdfgOgZ_0qyVAUx3FXm4Q@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement  (Andrew Dunstan <andrew@dunslane.net>)
List 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)

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
Attachment

pgsql-hackers by date:

Previous
From: Peter Smith
Date:
Subject: Re: POC: enable logical decoding when wal_level = 'replica' without a server restart
Next
From: Nathan Bossart
Date:
Subject: Re: Clarification on Role Access Rights to Table Indexes