Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Searched open and closed issues/PRs for DESC + PREPARE, DESCRIBE + COM_STMT_PREPARE, ClientPreparedStatement, prepareable_stmt, and DESC/DESCRIBE titles. No dedicated duplicate was found.
Related but distinct: #30890 / PR #32339 concern column-name/quoted-wildcard filters in DESCRIBE shortcuts; #25429 concerned binary PREPARE of REPLACE. This report concerns rejection of plain DESC/DESCRIBE at native PREPARE, before filtering or result metadata is produced.
Branch Name
main (frozen acceptance candidate; ordinary build, without the integration tag)
Commit ID
89ca3dbbf6d594d7614b8e1ca80f6b0300ed3cd2
Other Environment Information
- Hardware parameters: Linux/arm64 container, 4 CPU limit, 6 GiB memory limit.
- OS type: Linux/arm64 in Docker on an Apple Silicon host; standalone LOG/TN/CN configuration.
- Others: Go 1.27.1;
github.com/go-sql-driver/mysqlv1.9.3 using explicitPrepareContextandinterpolateParams=false. - Independent client check: MySQL Connector/J 8.0.15 with
useServerPrepStmts=true&emulateUnsupportedPstmts=false. - Compatibility control: MySQL 8.4.10 in an isolated container.
- Tested ordinary MatrixOne binary SHA256:
0ae125cb624dccd50c342821cecc696d5db64a3f86d9c217fa26e0e502d4614a.
Actual Behavior
COM_STMT_PREPARE rejects all four plain statements below with error 1064 / SQLSTATE 42000:
DESC claude_s5_desc_prepare.src;
DESCRIBE claude_s5_desc_prepare.src;
DESC claude_s5_desc_prepare.v;
DESCRIBE claude_s5_desc_prepare.v;Both the ordinary base table and the View contain one x INT column. The failure occurs at PREPARE, before EXECUTE or result-header comparison.
Representative captured error:
Error 1064 (42000): SQL parser error: You have an error in your SQL syntax; check the manual that corresponds to your MatrixOne server version for the right syntax to use. syntax error at line 1 column 57 near " claude_s5_desc_prepare.src";
Protocol controls on the same MatrixOne candidate:
| Statement family | COM_QUERY | SQL PREPARE ... FROM '...' + EXECUTE |
COM_STMT_PREPARE + EXECUTE |
|---|---|---|---|
| DESC / DESCRIBE base table | PASS | PASS | FAIL at PREPARE |
| DESC / DESCRIBE View | PASS | PASS | FAIL at PREPARE |
| SHOW COLUMNS FROM View | PASS | PASS | PASS |
| SHOW FULL COLUMNS FROM View | PASS | PASS | PASS |
The independent Go probe recorded 17/21 passing observations and exactly these four failures; cleanup succeeded. The equivalent MySQL 8.4.10 control recorded 21/21 PASS, including all four binary DESC/DESCRIBE cases. The missing-object negative control allows rejection at PREPARE or EXECUTE, since MySQL may defer that check to EXECUTE.
Driver fallback can hide this bug. Connector/J with unsupported-statement emulation enabled silently returns com.mysql.cj.jdbc.ClientPreparedStatement after the server-side prepare fails. With emulation disabled, connection.prepareStatement("desc ...") throws SQLSyntaxErrorException from ServerPreparedStatement.serverPrepare. Merely setting useServerPrepStmts=true is therefore not proof of binary-protocol coverage.
Expected Behavior
For a valid, authorized base table or View, native PREPARE of DESC and DESCRIBE should succeed and EXECUTE should return the same logical column description as the direct/SQL-prepared form, as on MySQL 8.4.10.
The fix should preserve MatrixOne's existing SHOW result contract (including its additional Comment column on ordinary SHOW), current authorization, and normal errors for missing/inaccessible objects. This issue does not request unrelated EXPLAIN syntax or a broad SHOW metadata redesign.
Steps to Reproduce
Create this minimal fixture on an owned test instance:
CREATE DATABASE claude_s5_desc_prepare;
CREATE TABLE claude_s5_desc_prepare.src (x INT);
CREATE VIEW claude_s5_desc_prepare.v AS SELECT x FROM claude_s5_desc_prepare.src;Use an explicit server-side prepare, not a driver-emulated query. In Go, establish a connection with github.com/go-sql-driver/mysql v1.9.3 and run the following core operations from the validated probe:
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
db, err := sql.Open("mysql", "dump:111@tcp(127.0.0.1:6001)/?timeout=5s&readTimeout=20s&interpolateParams=false")
if err != nil { panic(err) }
defer db.Close()
conn, err := db.Conn(ctx)
if err != nil { panic(err) }
defer conn.Close()
for _, query := range []string{
"desc claude_s5_desc_prepare.src",
"describe claude_s5_desc_prepare.src",
"desc claude_s5_desc_prepare.v",
"describe claude_s5_desc_prepare.v",
"show columns from claude_s5_desc_prepare.v",
"show full columns from claude_s5_desc_prepare.v",
} {
func() {
stmt, err := conn.PrepareContext(ctx, query) // COM_STMT_PREPARE
fmt.Printf("PREPARE %q: %v\n", query, err)
if err != nil { return }
defer stmt.Close()
rows, err := stmt.QueryContext(ctx) // COM_STMT_EXECUTE
if err != nil { panic(err) }
defer rows.Close()
columns, err := rows.Columns()
if err != nil { panic(err) }
fmt.Printf("EXECUTE columns: %v\n", columns)
for rows.Next() {} // Drain this description before the next statement.
if err := rows.Err(); err != nil { panic(err) }
}()
}Required imports: context, database/sql, fmt, time, and _ "github.com/go-sql-driver/mysql". Run inside a Go module with that driver dependency. Replace the local address/credentials as needed; the first four PREPARE calls fail on the tested MatrixOne candidate, while both SHOW controls succeed.
Direct and SQL-string-PREPARE controls:
DESC claude_s5_desc_prepare.src;
DESC claude_s5_desc_prepare.v;
PREPARE desc_control FROM 'DESC claude_s5_desc_prepare.v';
EXECUTE desc_control;
DEALLOCATE PREPARE desc_control;
DROP DATABASE claude_s5_desc_prepare;These SQL controls do not exercise native COM_STMT_PREPARE.
Additional information
Static localization at the tested commit
- Native PREPARE handling applies rewrite policy and then wraps the payload as the non-string
PREPARE <name> FROM <statement>form. prepareable_stmtadmitsshow_stmtandexplain_plan_stmt, but not the table-description branch.explain_stmtlowersexplain_sym unresolved_object_nametotree.ShowColumns. SQL string PREPARE follows a different grammar path, explaining why that control succeeds.
The change should close this specific acceptance mismatch without bypassing rewrite/authorization handling or indiscriminately admitting every EXPLAIN variant. Generated parser output should be regenerated through the repository tooling, not edited manually.
Regression checks for the eventual fix
- Plain DESC and DESCRIBE for both base tables and Views through real binary PREPARE/EXECUTE, plus direct and SQL-string-PREPARE controls.
- Prepared and execution column metadata, repeated execution, and changes made by another connection (DDL/rebuild); retain existing SHOW/FULL SHOW expectations.
- Missing-object and permission rejection, cleanup/connection usability after errors, and no client-emulation fallback masquerading as a pass.
Scope and attribution
Found during S5 acceptance for #29440 after #32259 / PR #32328. This issue reports the confirmed compatibility failure on the commit above; it does not reopen those items or assert overall S5 completion.
The same four failures were also observed in an archived 52cb + WIP binary. That is not a clean base-branch run. No clean pre-#32328 base was tested, so this report makes no claim that the bug was already present on clean base or that #32328 has been ruled out as a regression source. No product fix was made during this validation.
Activity
Ariznawlll commentedon Nov 9, 2026
结论
测试不通过。当前 main 的原生二进制 PREPARE 仍拒绝普通 DESC/DESCRIBE;直接文本语句可正常返回列定义。
关键证据
main@c99234dcf4c94d1ff9d372917cd35041f1a3a682,隔离本地 CN,运行时git_version()为c99234dcf4。cursor(prepared=True)实际发送二进制 PREPARE;DESC/DESCRIBE对 base table 与普通 view 全部在 PREPARE 阶段返回 1064。DESC table、DESCRIBE view均返回x INT列元数据;失败后连接可继续SELECT 1,每轮测试库已删除。待解决点
fix(parser): allow native PREPARE of DESC/DESCRIBE (#32399)
slyunnn commentedon Nov 11, 2026
Regression and extended verification for #32390 (2026-11-11)
Re-verified end to end on the latest
origin/mainwith real binary-protocol clients: nativeCOM_STMT_PREPAREof plainDESC/DESCRIBEnow succeeds for base tables and views, and the pre-fix rejection is still reproducible on the pre-fix control build. Result: Fixed.Verification Environment
origin/maincommit:45917e803f2915f6f0838b2b2fe9f591fc5b6018—fix(plan): fold contradictory same-column predicates to near-zero estimates (#32502); confirmed bygit merge-baseto contain fix merge6a2b29954749d5a47820ed429cfa8a6c4793682f.fix(parser): allow native PREPARE of DESC/DESCRIBE(merge6a2b29952b...alias6a2b299547, merged 2026-11-09). Direction: extract the table-description grammar productions into a shared rule and admit that rule inprepareable_stmt, so nativePREPARE ... FROM <statement>acceptsDESC/DESCRIBEwhile unrelatedEXPLAINvariants (includingFOR CONNECTION) stay outside the prepare boundary.mo-servicefrom thatorigin/maincommit,go1.27.1darwin/arm64 (GOEXPERIMENT=simd);-versionreports Git commit ID45917e803f, buildtime1794370498; module stamp SHA256a66e792499b046d200add687af9b30488059c777e3341642a04e43397b21cec6. Runtime identity re-checked at every endpoint-round:git_version()=45917e803f(12/12 consistent).d39d8a4034, pre-fix ancestor), SHA2562c16af1e4dd7afb194211233be625af96ebaaba588d2ddd944cfaf3476cb43fe, used only to re-confirm the original failure mode.2 CN / 1 TN / 1 LogService + Proxy. All three routes were connected and exercised: Proxy6001, CN116001, CN216002; every scenario below ran through each route over both the MySQL text protocol and the native binary protocol (COM_STMT_PREPARE). Clients:mysql-connector-python 26.10.0withcursor(prepared=True)(real server-side prepare, no driver emulation) andpymysql 2.2.8for text-protocol statements. Health checks alone do not count as endpoint coverage. After the full matrix the service was stopped and all three ports were released (no lingering listeners).DESC/DESCRIBEprepare/execute.What Was Covered
d39d8a4034): the four statements from the issue body —DESC <db>.t1;,DESCRIBE <db>.t1;,DESC <db>.v;,DESCRIBE <db>.v;— are rejected atCOM_STMT_PREPAREwith1064 (42000): SQL parser erroron every route (12/12expected rejections), while the same statements overCOM_QUERY, SQL-stringPREPARE ... FROM, and binary-preparedSHOW COLUMNS FROMkeep working on the same connections — confirming the probe genuinely exercises the binary protocol and reproducing the reported symptom exactly.6001, CN116001, CN216002in2rounds (24/24), returning the same column metadata as the text form (e.g.('x','int','YES','',NULL,'','')for both table and view targets).DESC t1through the default database matches the text result on every endpoint-round (6/6).DESC <db>.t1;returns byte-identical metadata across repetitions (6/6).SHOW COLUMNS FROM/SHOW FULL COLUMNS FROMand SQL-stringPREPARE ... FROM 'DESC ...'+EXECUTEall keep passing (6/6each) — the fix did not narrow existing prepareable statements.DESC <ghost>.t1now fails with the semantic error1049 (42000): Unknown database ...instead of the syntax error (6/6); the session remains usable after the error (SELECT 1,6/6).DESCon the admin-owned table is rejected with20101 (HY000): internal error: do not have privilege to execute the statement(non-syntax, as before the fix), and the session stays usable (6/6).ALTER TABLE ... ADD COLUMN yfrom a second connection on the same CN service, a fresh preparedDESCof the table sees columns('x','y'); afterDROP VIEW+CREATE VIEW ... AS SELECT y, a fresh preparedDESCRIBE <db>.vreturns the new view definition — matching the text form on every endpoint-round (6/6).SELECT 1after each failure (6/6), each route-round used its own fixture database and test user, all dropped before the next round; each endpoint-round assertedgit_version()identity (12/12).mysql-connector-pythonprepared cursors here and by the fix PR's in-repo Go binary-protocol tests; Connector/J was not exercised in this round.EXPLAIN ... FOR CONNECTIONand otherEXPLAINvariants at native prepare: explicit non-goal of the fix (they remain outsideprepareable_stmtby design).Findings
RESULT mode=control checks=39 failed=0(all expectations for the bug state held — four 1064-rejections per route plus parity controls).RESULT mode=full checks=126 failed=0across6endpoint-rounds (Proxy6001/ CN116001/ CN216002,2rounds).PREPAREgrammar admission (parser / frontend statement boundary); outcome class has no dependency on row count,LIMIT, block/batch boundaries, memory/spill, concurrency scale, skew, network transfer, or index state, so data volume cannot change the result; endpoint-round repetition already pins the behavior.probe.py,probe.log,results.json(full run) andcontrol/probe.log,control/results-control.json(pre-fix control),binary-identity.txt, launch logs; details available on request.MOTR / BVT Coverage
pkg/sql/parsers/dialect/mysql/prepare_description_test.go), a real binary-protocol regression suite (pkg/tests/issues/prepare_description_test.go— tables and views, repeated execution, PREPARE/EXECUTE column metadata, cross-connection DDL refresh, missing objects, permission rejection, connection usability after errors), and a BVT extension (view_metadata_wire_headersprepare controls). MOTR.testfiles cannot expressCOM_STMT_PREPARE(it is a binary-protocol command, not server-side SQL-stringPREPARE), so this round contributes the deployed-cluster, multi-endpoint, connector-level evidence instead, and no duplicate case is proposed.Final Conclusion
Fixed — verified on
origin/mainat45917e803f(contains fix merge6a2b299547, PR #32399): nativeCOM_STMT_PREPAREof plainDESC/DESCRIBEfor base tables and views now succeeds and returns the same metadata as the text form through Proxy6001, CN116001and CN216002alike, with126/126checks passing; missing objects and privilege failures degrade to their proper semantic errors (not1064), existing prepareable statement families are unaffected, and the pre-fix build still reproduces the original1064rejection (12/12), which no longer occurs on the fixed build.