--- a/src/Pure/General/sql.scala Wed Mar 08 22:08:48 2023 +0100
+++ b/src/Pure/General/sql.scala Wed Mar 08 22:22:35 2023 +0100
@@ -490,7 +490,9 @@
host: String = "",
port: Int = 0,
ssh: Option[SSH.Session] = None,
- ssh_close: Boolean = false
+ ssh_close: Boolean = false,
+ // see https://www.postgresql.org/docs/current/transaction-iso.html
+ transaction_isolation: Int = Connection.TRANSACTION_SERIALIZABLE
): Database = {
init_jdbc
@@ -518,6 +520,7 @@
}
try {
val connection = DriverManager.getConnection(url, user, password)
+ connection.setTransactionIsolation(transaction_isolation)
new Database(name, connection, port_forwarding)
}
catch { case exn: Throwable => port_forwarding.foreach(_.close()); throw exn }