Search code examples
postgresqltransactionsplpgsqlidentifier

Getting transactionid(xid) from SQL


Is there a way to get transactionid(xid) from SQL query, or from plpgsql function body?

version of PostgreSQL 9.3


Solution

  • http://www.postgresql.org/docs/9.3/static/functions-info.html#FUNCTIONS-TXID-SNAPSHOT

    txid_current() is probably what you are after.