Summary
PostgresConnection.inOpenTransaction probes pg_current_xact_id_if_assigned() IS NOT NULL (PG 13+). A BEGIN followed only by SELECT does not assign an XID, so the SQL-tab badge stays off and autocommit-off prepends a second BEGIN.
Scope
- Probe
pg_stat_activity.xact_start for pg_backend_pid() or track BEGIN/COMMIT/ROLLBACK locally on the session.
- Autocommit-off must not emit
BEGIN; concatenated with the next statement (see multi-statement execute issue).
- Cover BEGIN + SELECT 1 → tx open; COMMIT → closed.
Out of scope
- PG < 13 (document if the probe needs a fallback).
Summary
PostgresConnection.inOpenTransactionprobespg_current_xact_id_if_assigned() IS NOT NULL(PG 13+). ABEGINfollowed only bySELECTdoes not assign an XID, so the SQL-tab badge stays off and autocommit-off prepends a secondBEGIN.Scope
pg_stat_activity.xact_startforpg_backend_pid()or track BEGIN/COMMIT/ROLLBACK locally on the session.BEGIN;concatenated with the next statement (see multi-statement execute issue).Out of scope