Skip to content

Postgres wire: SAVEPOINT/RELEASE/ROLLBACK TO are accepted as no-ops, so a client-visible ROLLBACK TO silently keeps its writes #7846

Description

@lvca

Noted during review of #7815 (CodeRabbit's outside-diff finding, and the claude-review bot's response to it).

PostgresNetworkExecutor.queryCommand recognizes SAVEPOINT <name>, RELEASE <name> and ROLLBACK TO <name> on the simple query protocol, but none of the three branches calls into the transaction engine - they just return an empty result set:

} else if (upperCaseText.startsWith("SAVEPOINT ") ||
    upperCaseText.startsWith("RELEASE ") ||
    upperCaseText.startsWith("ROLLBACK TO ")) {
  transactionControl = true;
  resultSet = new IteratorResultSet(Collections.emptyIterator());
}

This no-op behavior predates #7815; that PR only changed the wire framing around it (it now answers with a bare CommandComplete instead of a zero-field RowDescription + CommandComplete, matching real PostgreSQL). But the framing change makes the gap more dangerous to a client: before #7815, psql printed an empty result table after ROLLBACK TO, which was at least a visible hint something odd was happening. After #7815, the response is indistinguishable from a real PostgreSQL server that honored the savepoint.

Concretely:

BEGIN;
INSERT INTO ...;         -- row A
SAVEPOINT sp1;
INSERT INTO ...;         -- row B
ROLLBACK TO sp1;         -- server answers CommandComplete "ROLLBACK", but row B is still pending
COMMIT;                  -- row B is persisted, even though the client asked to undo it

Any client or pooler that only checks the command tag (not just the ADBC/libpq status-driven ones #7815 targets) will believe the rollback-to-savepoint succeeded and go on to COMMIT a transaction it thinks no longer contains row B.

ArcadeDB's transaction engine does not currently expose savepoint/nested-transaction semantics (Database/DatabaseInternal has begin()/commit()/rollback() only), so implementing real SAVEPOINT/RELEASE/ROLLBACK TO is a real feature, not a one-line fix - it needs a savepoint-capable checkpoint inside the transaction (or a page/record-level undo log for a sub-range of the pending changes), tracked by name, with RELEASE discarding a savepoint and ROLLBACK TO undoing everything after it without ending the outer transaction.

Until that lands, the wire protocol should not claim success for an operation it didn't perform. The narrower, cheap fix is to make PostgresNetworkExecutor answer these three statements with an ErrorResponse (e.g. SQLSTATE 0A000, feature not supported) instead of CommandComplete, so a client finds out its savepoint was never taken rather than silently keeping writes it asked to discard.

Activity

  1. self-assigned this
    on Sep 17, 2026
  2. added theissue type on Sep 17, 2026
  3. added this to the 26.10.1 milestone on Sep 17, 2026
  4. added
    in progress
    on Sep 17, 2026
  5. removed
    in progress
    on Sep 18, 2026
  6. lvca commented on Sep 18, 2026

    @lvca
    MemberAuthor

    Fixed in #7848 (merged).

    ROLLBACK TO <savepoint> used to be silently accepted even though it did nothing, so a client could believe a partial rollback worked while the writes it meant to undo were still going to be saved on the next COMMIT. The server now rejects ROLLBACK TO with a clear error and cancels the whole transaction instead, so you can never lose track of what was actually saved. SAVEPOINT and RELEASE are unaffected.

    While looking into this, a related (separate, pre-existing) issue with connection state after certain errors was found and filed as #7851 for a future fix.


    ❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.

  7. added a commit that references this issue on Sep 18, 2026
  8. added a commit that references this issue on Sep 19, 2026
    db56f64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions