Repository navigation
Description
Description
MatrixOne returns 20301 when a Go MySQL client executes a valid prepared range predicate against a DATETIME column and binds the time values as strings.
Environment
- Branch:
main - MatrixOne commit:
a73f76d109bd528ae2e53a4b8ab294422fb13e21 - Deployment: 7-pod distributed stability cluster (2 CN, 1 DN, 3 LogService, 1 Proxy)
- Test date: 2026-08-28
Steps to reproduce
-
Use Go
database/sqlwithgithub.com/go-sql-driver/mysql. -
Execute this statement through
QueryRowContext, binding both markers as Go strings:SELECT COUNT(*) FROM mo_cloud.storage WHERE collecttime > ? AND collecttime <= ?
-
Bind
"2026-05-01 08:55:23"and"2026-05-19 04:14:00".
mo_cloud.storage.collecttime is DATETIME NOT NULL and has a primary key beginning with collecttime.
Actual behavior
The Go-driver execution fails before the load test starts:
Error 20301 (HY000): invalid input: "2026-05-01 08:55:23" is invalid numeric string
The failure is stable: 3/3 identical read-only executions failed (26.90 s, 1.36 s, 1.26 s).
Expected behavior
MatrixOne should accept valid string temporal parameters for comparison with a DATETIME column and return the count, as MySQL-compatible prepared statements do.
Stability and controls
- The normal control used the same SQL, same two values, and server-side
PREPARE/EXECUTE; it returned48,934,000rows in 3/3 executions. - The test connected successfully, verified the table exists, and verified the
collecttimeprimary-key column before the failing statement. - All reproductions were read-only. No new pod restart, panic, or leftover process was observed in the target stability cluster.
Evidence
- Failing stability run/job: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/33090737731/job/98591158753
- Reproducer:
motr/suites/scenarios/issue_10313_storage_query/instance_worker_storage_test.go,countRowsInQueryWindow(line 233)
Code analysis
The reproducer sends the two valid datetime values through the Go MySQL driver's binary prepared-statement protocol. MatrixOne appears to attempt numeric conversion for the temporal string during this path. This is a confirmed protocol/temporal-parameter behavior difference; the exact server-side conversion location remains to be investigated.
Regression coverage
After a product fix, add a stable public-SQL regression that covers binary-protocol prepared DATETIME range predicates with string temporal parameters.
Activity
fix(plan): preserve temporal prepared range types (#27882)
slyunnn commentedon Sep 8, 2026
Regression and extended verification for #27774 (2026-09-08)
Verification Environment
origin/mainat8198fd4d7ec0c616a6c8b138f3c86284d70b2a5a—fix(sql): preserve cluster table account default on truncate (#28374).ef4ac3ed9b44474257e72b911bb5e4fa1b6c8c4b; product commitfdb0f921cb3eb958282eda0625414c06ea3d9b92—fix(plan): preserve temporal prepared range types.127.0.0.1:26001; no Proxy and no multi-CN routing.TestIssue27774PreparedTemporalCompositeRangeon the embedded base cluster; PR#27882documents this regression as a real two-CN Godatabase/sqlandgo-sql-driver/mysqltest.1: exact-main focused CGo testTestIssue27774PreparedTemporalCompositeRangeinpkg/tests/issues.2: new MOTR Go protocol script against127.0.0.1:26001.3: new MOTR SQL record and replay case against127.0.0.1:26001.database/sqlwithgithub.com/go-sql-driver/mysql;interpolateParams=falseexercisesCOM_STMT_PREPAREandCOM_STMT_EXECUTEwith string parameters.interpolateParams=trueand the SQL case provide MySQL text-query protocol controls.What Was Covered
DATETIMEcomposite-primary-key range predicate with string bounds returns the expected count2and does not return error20301.DATE,DATETIME, andTIMESTAMPranges each accept valid string bounds and return the expected count.NULLlower bound; results are1and0respectively.not-a-datetimereturns error20301containinginvalid datetime value, notinvalid numeric string.DATETIMEexecution after the invalid execution still returns2, proving the failed execute does not poison the prepared statement.interpolateParams=true, server-side SQLPREPARE/EXECUTE, and literal SQL produce the same temporal range counts.2CN,1DN,3LogService,1Proxy), external MySQL differential execution, and load-test throughput/latency measurement.Findings
The original
20301failure is not reproducible on currentorigin/main. Valid Go string DATETIME bounds retain their temporal domain through binary prepared execution instead of being re-specialized as DECIMAL values.Large-data regression is not needed. The root cause is prepared-parameter type specialization at an implicit temporal cast boundary, not cardinality, block/batch size, memory/spill, concurrency, skew, network transport volume, or resource scale. The minimum four-row composite-primary-key fixture exercises the relevant temporal range contract without adding unrelated CI cost.
MOTR / BVT Coverage
suites/14_issue_regression/t/issue_27774_prepared_datetime_range.testand recorded resultsuites/14_issue_regression/r/issue_27774_prepared_datetime_range.result.script/14_issue_regression/issue_27774_prepared_datetime_range_protocol.go, launch script, and recorded output baseline.14statements,14expected outcomes, passed.14statements,14expected outcomes, passed.DATE,DATETIME,TIMESTAMP, invalid input, recovery, text control, and cleanup assertions all passed with an exact output match.0645d67e3e29c2600cfe75070443f04fe965c22d—test: add MOTR regression for #27774.test/issue-27774-prepared-datetime-rangeinmatrixorigin/motr.Final Conclusion
Fixed. Current
origin/mainaccepts valid Go binary prepared temporal range parameters and returns a temporal validation error only for invalid DATETIME values. No large-data regression is required for the reasons above.fix(plan): preserve temporal prepared range types (matrixorigin#27882)
fix(plan): preserve temporal prepared range types (matrixorigin#27882)
fix(plan): preserve temporal prepared range types (matrixorigin#27882)