What you ask for is usually called an autonomous transaction.
PostgreSQL does not support offline transactions at this time (9.4).
For proper support, they really need stored procedures, not just user-defined functions that are currently supported. It is also very difficult to implement standalone tx in PostgreSQL for many internal reasons related to its session and process model.
For now, use dblink, as suggested by Bob.
Craig Ringer Jul 02 '14 at 5:46 a.m. 2014-07-02 05:46
source share