Repository navigation
Description
MatrixOne version
Latest main at a9d3b8b857c44f1249e682c91d4d62a914eb7d20. MySQL control: 8.3.0.
What is wrong
OCT() applies date-first parsing and strict whole-string integer parsing to string arguments. This changes valid numeric strings, rejects MySQL-compatible numeric prefixes, and makes a TIME value depend on the current calendar year.
Representative results:
expression MatrixOne MySQL 8.3
OCT('12tail') error 20203 14
OCT('12.5') error 20203 14
OCT('abc') error 20203 0
OCT('') error 20203 NULL
OCT('20240506') 3750 115154172
OCT('20240101123456') 3750 446420402322600
OCT(TIME '12:34:56') 3752 (octal for year 2026) 14
The compact numeric strings are interpreted as dates by MatrixOne and reduced to their year (2024, whose octal representation is 3750). MySQL instead applies numeric conversion to string arguments. For a typed TIME, MatrixOne currently returns the octal representation of the current year, so the result is also time-dependent.
Reproduction
SELECT OCT('12tail'), OCT('12.5'), OCT('abc'), OCT('');
SELECT OCT('20240506'), OCT('20240101123456');
CREATE TABLE t(s VARCHAR(32), tm TIME);
INSERT INTO t VALUES ('12tail', '12:34:56');
SELECT OCT(s), OCT(tm) FROM t;
PREPARE p FROM 'SELECT OCT(?)';
SET @v = '20240506';
EXECUTE p USING @v;The scalar, column, and prepared-statement forms were reproduced in three independent databases per engine. A mixed VARCHAR scan in MatrixOne aborts at the first non-strict value, while MySQL produces a result for each row.
Controls
- Integer,
DECIMAL, andDOUBLEcolumns produce the same octal values in both engines for ordinary inputs. - Typed
DATEandDATETIMEvalues currently produce the same year-based values in both engines. - A pure integer string such as
'12'returns14in both engines. - The connection remains usable after MatrixOne returns error 20203.
Root cause
OctString attempts ParseDatetime and ParseDateCast before numeric conversion, and the fallback uses strict strconv.ParseInt on the entire string. The same string executor is selected for TIME, allowing 12:34:56 to be parsed as a datetime with the current year.
Expected behavior
String and TIME arguments should follow MySQL-compatible numeric conversion semantics. Numeric prefixes should be converted without aborting the query, compact numeric strings should remain numeric, empty/invalid inputs should follow MySQL's NULL/zero behavior, and the result must not depend on the current year.
Activity
Ariznawlll commentedon Sep 9, 2026
在同步后的最新
main(f0c31cd4b830be32442cf329e0a3fb08aa9c16c3)重新执行原矩阵,问题仍存在且连续 3 轮结果一致:字符串数值前缀仍报 20203,紧凑日期形数字仍被截取为年份,TIME '12:34:56'仍返回当前年份 2026 的八进制值3752。整数、DECIMAL、DOUBLE、DATE、DATETIME 控制未变化。fix: align OCT compatibility and result metadata (#28533)
Ariznawlll commentedon Sep 11, 2026
测试版本
maine7d46d6dfb27696211ca828c55e245d3bd1b634d原问题验证
在隔离数据库中连续执行 3 轮原始触发路径:
OCT('12tail')、OCT('12.5')、OCT('abc')、OCT('')、OCT('20240506')、OCT('20240101123456')、OCT(TIME '12:34:56'),以及列值和 SQLPREPARE/EXECUTE参数路径。3/3 均无报错;字符串前缀/小数返回14,非数字返回0,空串返回NULL,紧凑数字字符串按数值转换,TIME12:34:56稳定返回14,未再依赖当前年份。Happy Path 覆盖
OCT(12)、DECIMAL12.5与 DOUBLE12.5均返回14。2024-05-06均返回3750;正、负 TIME 分别返回14和1777777777777777777764。20240506与12tail,结果为115154172与14。Unhappy Path 覆盖
abc与空串不再中止混合查询,分别受控返回0与NULL。白盒验证
不适用:本次为真实 MatrixOne 服务上的 SQL 黑盒验收;修复实现已随 MatrixOne PR #28533 合入当前 main。
回归测试
14_issue_regression.issue_28465_28466_oct_compatibility./motr --repeat 3 14_issue_regression.issue_28465_28466_oct_compatibility,3/3 通过,72 条 SQL 均成功。测试证据
information_schema.schemata,隔离测试库残留数为0。测试结论
测试通过。
fix: align OCT compatibility and result metadata (matrixorigin#28533)
fix: align OCT compatibility and result metadata (matrixorigin#28533)
fix: align OCT compatibility and result metadata (matrixorigin#28533)