How can I query the transaction-isolation level of an existing postgres session?

I don't think there's any way to look into one session from within another session. (I could be wrong.)

The only alternative I can think of is to expand your logging. In postgresql.conf, set

logging_collector = on
log_statement = 'all'

Restart the server.

This will log all SQL statements, including those that set the transaction isolation level. There are a lot of settings; log_connections might be a useful one.

So you'd assume that the isolation level is "read committed" unless you log a different isolation level.


You can show all the information by running SHOW all. If you want to show the isolation level run this:

SHOW default_transaction_isolation