You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: DEALLOCATE PREPARE silently succeeds for an unknown statement #25978
DEALLOCATE PREPARE silently succeeds when the named prepared statement does not exist or has already been deallocated.
Tested version
main at 3046f14d94b3f1a25839eeeb65729b64f85ac647.
Reproduction
DEALLOCATE PREPARE does_not_exist;
Also:
PREPARE s FROM'SELECT 1';
DEALLOCATE PREPARE s;
DEALLOCATE PREPARE s;
Actual result
Both statements complete successfully without an error. The missing-name case reproduces 3/3 times.
Expected result
Return an unknown prepared statement error. MySQL 8.0.45 returns:
ERROR 1243 (HY000): Unknown prepared statement handler (...) given to DEALLOCATE PREPARE
Root cause
doDeallocate builds a deallocate plan and then calls Session.RemovePrepareStmt. RemovePrepareStmt checks whether an entry exists only to close it, but unconditionally deletes the map key and returns no status. As a result, doDeallocate cannot distinguish a successful removal from a missing statement.
The binary COM_STMT_CLOSE path already performs an explicit GetPrepareStmt check before deallocation, so textual and binary prepared-statement cleanup currently have different missing-name behavior.
Activity
Ariznawlll commentedon Jul 22, 2026
最新 main 回归结果(2026-07-22)
c0486a2446c84c6dd6bf142494fe85243877ddc5DEALLOCATE PREPARE。fix(frontend): reject unknown prepared deallocation (#26259)
Ariznawlll commentedon Jul 30, 2026
测试版本
main(截至 2026-07-30 16:30,Asia/Shanghai)41332062a6740978f269088a92ee362a888c7bd7etc/launch-with-proxy/launch.toml(2 CN + 1 TN + Proxy),SQL 入口127.0.0.1:6001原问题验证
直接
DEALLOCATE PREPARE does_not_exist和对同一 statement 二次 DEALLOCATE 均返回 unknown prepared statement 错误;完整黑盒 3/3 通过。Happy Path 覆盖
SELECT 1/2均正常,连接未被破坏。Unhappy Path 覆盖
白盒验证
TestRemovePrepareStmt连续 3 轮通过。回归测试
修复提交
071f8e4ba已加入test/distributed/cases/prepare/deallocate_unknown.sql。测试证据
完整 3 轮 SQL 结果、测试脚本、Proxy 黑盒日志、定向 UT 与
-race输出:https://gist.github.com/Ariznawlll/b8f1a22642a58fd5264482687534728b测试结论
测试通过。
Ariznawlll commentedon Jul 30, 2026
motr 黑盒回归已补充
suites/14_issue_regression/t/issue_25978_deallocate_unknown.testmain@41332062a6740978f269088a92ee362a888c7bd7,该批 14 个用例连续 3 轮为 42/42 成功(504/504 语句);完整14_issue_regressionsuite 为 124 成功、0 失败。fix(frontend): reject unknown prepared deallocation (matrixorigin#26259)
fix(frontend): reject unknown prepared deallocation (matrixorigin#26259)
fix(frontend): reject unknown prepared deallocation (matrixorigin#26259)