Message-ID: From: "frlzk (@frlzk)" To: "pgjdbc/pgjdbc" Date: Wed, 11 Mar 2026 12:34:08 +0000 Subject: [pgjdbc/pgjdbc] issue #3955: The value of backend_xmin has different transaction behaviors in JDBC and PSQL List-Id: X-GitHub-Author-Id: 37818906 X-GitHub-Author-Login: frlzk X-GitHub-Issue: 3955 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-State: open X-GitHub-Type: issue X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/3955 Content-Type: text/plain; charset=utf-8 **Describe the issue** Use jdbc backend_xmin has value. Use psql backend_xmin not have value. **Driver Version?** 42.6.0 **Java Version?** 17 **OS Version?** ubuntu 24 **PostgreSQL Version?** 15 **To Reproduce** Use jdbc ``` import java.sql.*; public class AdvisoryLockExample { public static void main(String[] args) { String url = "jdbc:postgresql://127.0.0.1:5432/testdb"; String user = "testuser"; String password = "123456"; Connection conn = null; Statement stmt = null; ResultSet rs = null; try { conn = DriverManager.getConnection(url, user, password); conn.setAutoCommit(false); System.out.println("Transaction started (auto-commit disabled)."); stmt = conn.createStatement(); rs = stmt.executeQuery("SELECT '888888 '"); if (rs.next()) { String info = rs.getString(1); System.out.println("info: " + info); } rs.close(); System.out.println("Transaction left open (idle in transaction)."); System.out.println("Press Enter to commit and exit..."); System.in.read(); conn.commit(); System.out.println("Transaction committed."); } catch (SQLException | java.io.IOException e) { e.printStackTrace(); if (conn != null) { try { conn.rollback(); } catch (SQLException ex) { ex.printStackTrace(); } } } finally { if (rs != null) try { rs.close(); } catch (SQLException ignored) {} if (stmt != null) try { stmt.close(); } catch (SQLException ignored) {} if (conn != null) try { conn.close(); } catch (SQLException ignored) {} } } } ``` ``` SELECT * FROM pg_stat_activity WHERE query like '%8888%' \gx ``` Use psql ``` BEGIN; SELECT '888888'; ``` ``` SELECT * FROM pg_stat_activity WHERE query like '%8888%' \gx ``` **Expected behaviour** When use jdbc the backend_xmin is null