Search Postgresql Archives

C functions with COMMIT/ROLLBACK?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everyone,

Is is possible to add handlers so that a C function is fired when a transaction is committed or rolled back, for example (pseudo code):

BEGIN;
CALL my_function(1);
CALL my_function(2);
CALL my_function(3);
ROLLACK;

my_function()
  Create "my_file.txt.tmp"
  Write some information to it

commit_handle()
  Rename "my_file.txt.tmp" to "my_file.txt"

rollback_handle()
  Delete "my_file.txt"

OK, now is it possible to get postgres to call commit_handle() or rollback_handle() for COMMIT and ROLLBACK respectively? Is it even possible to carry context information (for C) throughout an entire transaction?

P.S. Yes, I understand how silly that example is and all the things practically wrong with it but its the concept of firing a C function when a transaction ends and whether it succeeded or not.
-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux