pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feed[pgjdbc/pgjdbc] issue #3955: The value of backend_xmin has different transaction behaviors in JDBC and PSQL
4+ messages / 2 participants
[nested] [flat]
* [pgjdbc/pgjdbc] issue #3955: The value of backend_xmin has different transaction behaviors in JDBC and PSQL
@ 2026-03-11 12:34 "frlzk (@frlzk)" <[email protected]>
0 siblings, 0 replies; 4+ messages in thread
From: frlzk (@frlzk) @ 2026-03-11 12:34 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
**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
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3955: The value of backend_xmin has different transaction behaviors in JDBC and PSQL
@ 2026-04-20 13:52 ` "davecramer (@davecramer)" <[email protected]>
2 siblings, 0 replies; 4+ messages in thread
From: davecramer (@davecramer) @ 2026-04-20 13:52 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
Interesting, thanks for the report
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3955: The value of backend_xmin has different transaction behaviors in JDBC and PSQL
@ 2026-04-20 13:54 ` "davecramer (@davecramer)" <[email protected]>
2 siblings, 0 replies; 4+ messages in thread
From: davecramer (@davecramer) @ 2026-04-20 13:54 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
I just tried this with psql
```
backend_xmin | 1612181
```
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3955: The value of backend_xmin has different transaction behaviors in JDBC and PSQL
@ 2026-04-20 15:24 ` "davecramer (@davecramer)" <[email protected]>
2 siblings, 0 replies; 4+ messages in thread
From: davecramer (@davecramer) @ 2026-04-20 15:24 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
I'm unable to recreate this
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2026-04-20 15:24 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-03-11 12:34 [pgjdbc/pgjdbc] issue #3955: The value of backend_xmin has different transaction behaviors in JDBC and PSQL "frlzk (@frlzk)" <[email protected]>
2026-04-20 13:52 ` "davecramer (@davecramer)" <[email protected]>
2026-04-20 13:54 ` "davecramer (@davecramer)" <[email protected]>
2026-04-20 15:24 ` "davecramer (@davecramer)" <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox