Question

Is there a field in the persistent config where I can set the desired isolation level for the session?

Or alternatively, is it possible to execute SQL code when the connection is established and before any transactions run? That would allow me to

set session transaction isolation level ...
Was it helpful?

Solution

The function createSqlPool is used by the scaffolding to create your connection pool. It takes as its first argument an IO Connection action. If you're using PostgreSQL, you can create a Connection value via openSimpleConn. Putting that together, you can:

  • Create a postgresql-simple connection.
  • Set the transaction level.
  • Call openSimpleConn

If you write a function that does that and pass that to createSqlPool, you should get the behavior you're looking for.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top