Message-ID: From: "prokop7 (@prokop7)" To: "pgjdbc/pgjdbc" Date: Tue, 31 Jan 2023 12:43:12 +0000 Subject: [pgjdbc/pgjdbc] PR #2741: feat: add transaction isolation mode List-Id: X-GitHub-Author-Id: 16087095 X-GitHub-Author-Login: prokop7 X-GitHub-Issue: 2741 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-State: open X-GitHub-Type: pull_request X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/pull/2741 Content-Type: text/plain; charset=utf-8 add transaction isolation mode to be able to work with transaction pooling tools like pgbouncer ### All Submissions: * [x] Have you followed the guidelines in our [Contributing](https://github.com/pgjdbc/pgjdbc/blob/master/CONTRIBUTING.md) document? * [x] Have you checked to ensure there aren't other open [Pull Requests](../../pulls) for the same update/change? ### New Feature Submissions: 1. [x] Does your submission pass tests? 2. [x] Does `./gradlew autostyleCheck checkstyleAll` pass ? 3. [x] Have you added your new test classes to an existing test suite in alphabetical order? ### Transaction isolation mode Adding this functionality discussed here https://github.com/pgjdbc/pgjdbc/issues/1880. Currently isolation level is set on connection level. This solution doesn't work with transaction pooling because the connection can be replaced after setting isolation. Proposed solution adds transaction isolation mode, which can be on of `transaction` or `session`, by default it's session. If the mode set to `transaction` then all `BEGIN` statements appended with isolation level like `BEGIN ISOLATION LEVEL SERIALIZABLE` The solution also works with READ ONLY modifier which was added in earlier versions. Implementation requires 3 flags, one for mode (0 - session mode, 1 - transaction mode) and two for isolation level (00 - READ UNCOMMITTED, 01 - READ COMMITTED, 10 - REPEATABLE READ, 11 - SERIALIZABLE) --- Solves https://github.com/pgjdbc/pgjdbc/issues/1880 Related to this PR, but it's already outdated and solved https://github.com/pgjdbc/pgjdbc/issues/848