Skip to content

fix(postgres): inOpenTransaction must detect BEGIN without an assigned XID #787

Description

@ZhuchkaTriplesix

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).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendBackend database driver execution and queriesbugSomething isn't workingeditorCode/SQL editorerror-handlingTheme parser epic label: error-handling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions