Message-ID: From: "vlsi (@vlsi)" To: "pgjdbc/pgjdbc" Date: Wed, 09 Jul 2025 08:40:46 +0000 Subject: Re: [pgjdbc/pgjdbc] issue #3107: JDBC driver sends "SAVEPOINT" query without finishing extended query protocol cycle In-Reply-To: References: List-Id: X-GitHub-Author-Login: vlsi X-GitHub-Comment-Id: 3051715469 X-GitHub-Comment-Type: issue_comment X-GitHub-Issue: 3107 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/3107#issuecomment-3051715469 Content-Type: text/plain; charset=utf-8 Here's the discussion thread on hackers: * https://www.postgresql.org/message-id/20240130.082257.800729082723903188.t-ishii%40sranhm.sra.co.jp Note that pgjdbc can't use extended protocol for `savepoint pgjdbc_autosave` since we can't allow "prepared statement doe snot exist" for autosave queries (it defeats the purpose of `autosave`): https://www.postgresql.org/message-id/CAB%3DJe-HqHHqryuebk8MZGLpginRATRXHbP5_XvGG1arKtCWe0g%40mail.gmail.com At the same time, currently, the error message is pgpool2-specific only. PostgreSQL does not throw such errors yet: https://www.postgresql.org/message-id/CAB%3DJe-HQ0Zwy1QWo2OpRcu3d41XW_o35ZV%3D12cS94%3D4DP6fw1A%40mail.gmail.com The fix could probably be sending extra sync message before sending a simple query, however: 1) The error is pgpool2-specific only 2) Probably we should inject `sync` messages if we send a simple query before sending an extended one: https://www.postgresql.org/message-id/20240228.210532.1955389974353647116.t-ishii%40sranhm.sra.co.jp 3) We probably need to account for transaction safety as it looks like extra `sync` might close the currently active transaction: https://www.postgresql.org/message-id/CAGECzQSEeZMR%2Bhc9%2BtM%2BiGeOxWEx53VB0WKLyx1EOjt_y%3DNAKg%40mail.gmail.com