Skip to content

test harness: setting .autocommit on pgc_conn silently does nothing #1420

Closed

Description

@jdatcmd

What happens

pgc_conn is a _WatchedConnection (test/pytest/pgc_vacuity.py:1202). It forwards attribute reads through __getattr__ but has no __setattr__. So pgc_conn.autocommit = False creates an attribute on the wrapper, and the real connection stays in autocommit.

A test that relies on it fails silently. Each statement commits, and pgc_conn.rollback() does nothing. I hit this writing #1419: the twin ran compact_rewrite after pgc_conn.autocommit = False, then called rollback(), and the rewrite had committed. The arm read 10/6400 row groups where the shell twin read 10/10000. It went red only because the arm compared before and after. An arm that expected the change to persist would have passed for the wrong reason.

Today

No test in the corpus sets it to False. Two of my open PRs (#1416, #1418) set it to True, a no-op that I've since removed.

Proposed fix

Give _WatchedConnection a __setattr__ that either forwards to the real connection or raises. Raising is safer: a test that wants a transaction should issue BEGIN/ROLLBACK or open its own connection, as the existing twins do. Pin it with a guard test that assigns .autocommit and expects the chosen behaviour.

I haven't written this yet. It touches the shared harness, so I'd like your view on forward versus raise first, @OffgridwithJD.

Activity

  1. added a commit that references this issue on Oct 15, 2026
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions