How do I find out the numeric ID of the current Postgres Transaction?
"System Information Functions", "Transaction IDs and Snapshots".
You can get the transaction id from:
txid_current()
You can additionally get the in-progress transactions in the snaption it's seeing from:
txid_snapshot_xip(txid_current_snapshot())
A few more functions are detailed in the manual:
http://www.postgresql.org/docs/current/static/functions-info.html#FUNCTIONS-TXID-SNAPSHOT
Postgres has added txid_current_if_assigned()
in version 10.