Repository navigation
Description
Bug or Feature Request
Bug
Description
SAVEPOINT <name> silently succeeds (returns OK) but the matching ROLLBACK TO SAVEPOINT always fails with a hard error — leaving the user in a broken half-transaction state where the only escape is rolling back the entire transaction:
mysql> BEGIN;
Query OK
mysql> SAVEPOINT spX; -- accepted, OK, no warning
Query OK
mysql> SELECT ...; -- work continues
mysql> ROLLBACK TO SAVEPOINT spX;
ERROR 20101 (HY000): internal error: savepoint has not been implemented yet. please rollback the transaction.
This is a "half-implemented statement" pattern: the parser accepts SAVEPOINT, the executor acknowledges it (source: pkg/frontend/mysql_cmd_executor.go:5610 — case *tree.SavePoint, *tree.ReleaseSavePoint: return nil — silently a no-op), and only the rollback leg reveals the truth (case *tree.RollbackToSavePoint: ... "savepoint has not been implemented yet. please rollback the transaction.").
Why this is a real compatibility break, not just a missing feature:
-
ORM drivers break at runtime. Django (
transaction.atomicnested), SQLAlchemy (begin_nested), Sequelize, Knex etc. issue SAVEPOINT for nested transactions / inner atomic blocks. Against MatrixOne, the SAVEPOINT statement succeeds, so the ORM proceeds under the assumption nested-rollback is available; the failure then detonates later in the middle of application logic — possibly after a partial DML batch — with the only recovery being full-transaction rollback. If instead SAVEPOINT errored up front, the drivers would fall back to emulation or refuse cleanly at connect/probe time. -
Hand-written procedures get half-executed. A script that runs
SAVEPOINT a; <DML batch>; ROLLBACK TO SAVEPOINT aon error — the standard batch pattern — commits the DML batch on success paths fine, but on the error path discovers the rollback command doesn't exist, and per the error message's own instruction must discard ALL work of the outer transaction. -
RELEASE SAVEPOINT is likewise accepted-and-ignored (same no-op case arm), so even the "cleanup" half of the protocol lies.
Steps to Reproduce
v3.x @ b24d1b3, macOS arm64:
BEGIN;
SAVEPOINT spX; -- Query OK (silently invalid)
SELECT 'still working' AS x; -- continues fine
ROLLBACK TO SAVEPOINT spX;
-- ERROR 20101 (HY000): internal error: savepoint has not been implemented yet. please rollback the transaction.
ROLLBACK; -- the only way out per the error messageControls:
SAVEPOINT spX;alone in a transaction → OK (no error, no warning) — evidence it's accepted-and-dropped.RELEASE SAVEPOINT spX;→ also OK, no-op.- MySQL 8: all three statements work; savepoints are core SQL/MySQL transactional protocol since 4.x.
Expected behavior
Pick one, but be consistent:
- Implement SAVEPOINT / ROLLBACK TO / RELEASE (MySQL semantics), or
- Reject
SAVEPOINT(and RELEASE) with anot supportederror immediately — mirroring the existing behavior of ROLLBACK TO SAVEPOINT — so drivers and scripts fail fast at the first statement rather than being led into a transaction they can no longer control.
Silently accepting SAVEPOINT while its counterpart errors is the worst of both worlds.
Versions
- MatrixOne commit
b24d1b3(2026-10-16), v3.x dev, macOS arm64
Additional context
- Source pointers:
pkg/frontend/mysql_cmd_executor.go:5610(case *tree.SavePoint, *tree.ReleaseSavePoint: return nil),:5612-5613(ROLLBACK TO arms the hard error). - Same family of accepted-but-unimplemented statements: [Bug]: SET DEFAULT ROLE is a silent no-op — statement returns OK but never persists (mo_user.default_role unchanged, new connections stay public, role privileges unusable without manual SET ROLE every session) #30677 (SET DEFAULT ROLE silent no-op), SHOW ENGINES (empty result set). Recommend a policy-level sweep: every statement kind the parser accepts should either execute or report not-supported.
Activity
XuPeng-SH commentedon Oct 22, 2026
Consolidated into #23125. The accepted-but-no-op SAVEPOINT behavior from this report is retained there alongside the newer report of an explicit error at SAVEPOINT.
Ariznawlll commentedon Oct 26, 2026
This is still reproducing on current main and now has a worse consequence than a plain error: the whole transaction is silently discarded, so a client that used SAVEPOINT as a partial-rollback guard loses its committed-so-far work.
So the failure mode is not "savepoint is a no-op": the
ROLLBACK TOerror aborts the entire transaction, and the subsequentCOMMITcommits nothing. Clients using the common pattern "do work, savepoint, risky work, rollback to savepoint on error, commit the good part" lose the good part entirely.At minimum,
SAVEPOINTshould raise the same "not implemented" error immediately (asROLLBACK TOdoes) so clients fail fast instead of building on a guard that silently discards everything.Ariznawlll commentedon Oct 29, 2026
Regression re-verification (main
c6683bd2f5, 2026-10-29): the ganz pathology from this report is still present — SAVEPOINT is accepted, RELEASE SAVEPOINT is accepted, and only ROLLBACK TO SAVEPOINT errors, with the enclosing transaction continuing to a full COMMIT:The "accept-the-syntax, reject-the-only-meaningful-verb" shape is worse than an outright 1064: scripts declaring savepoints see every statement parse and only fail at the rollback instant, by which time the guarded work has already happened — and the subsequent successful COMMIT persists what the developer explicitly tried to roll back. In the trace above the final table contains all 3 rows.
If the closure was about the syntax layer only (grammar accepting SAVEPOINT/RELEASE), the semantic half remains open on main; re-open or I can file a fresh standalone. Same closure-status pattern as #23126 (SKIP LOCKED) re-verified today in my session — worth a sweep of recently-closed transaction/compat issues.