Doing something at commit/rollback

As of this writing, there is no possibility to define a trigger function which is executed ON COMMIT or ON ROLLBACK. However, if you really need to have some code executed on these database events, you have a possibility to register a C-language function to be called on these events. Unfortunately, this registration cannot be done in a permanent way like triggers, but the registration function has to be called each time a new connection starts:

RegisterXactCallback(my_xact_callback, NULL); 

Use grep -r RegisterXactCallback in the contrib/ directory of PostgreSQL's source code to find files with examples of actual callback functions.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.42.87