Repository navigation
Description
Description
An explicit CAST of numeric-prefix text to SIGNED returns the correct value and warning code, but MatrixOne describes the conversion as DOUBLE in the warning. MySQL 8.0.46 describes it as INTEGER.
The observed difference is diagnostic text; it is not a wrong numeric result.
Environment
- MatrixOne:
mainat802376360c574f44aea23db5eef3cfcebf0527fd; the freshly built runtime reportedgit_version() = 8023763. - Deployment: isolated local
2 CN / 1 TN / 1 LogService / Proxy. - Client: MySQL CLI over the MySQL TCP protocol; the reproducer was executed through Proxy.
- Comparison: an isolated MySQL
8.0.46instance. - Verification date: 2026-10-27.
Steps to reproduce
Run both statements in the same session on each server. Inspect SHOW WARNINGS immediately after the SELECT.
SELECT CAST('42tail' AS SIGNED);
SHOW WARNINGS;Actual behavior
MatrixOne returns 42 and emits:
Level: Warning
Code: 1292
Message: Truncated incorrect DOUBLE value: '42tail'
The query succeeds; the mismatch is the type name in the warning.
Expected behavior
MySQL 8.0.46 returns 42 and emits:
Level: Warning
Code: 1292
Message: Truncated incorrect INTEGER value: '42tail'
If exact warning text is part of MatrixOne's MySQL compatibility contract, a truncated SIGNED cast should preserve the current result and warning code while naming INTEGER. Please confirm the intended diagnostic contract.
Stability and controls
- Numeric-prefix reproducer: executed once on each server in the stated environment; both returned
42and warning1292, with the message difference above. Repeated-run stability has not been established. - Invalid-text control:
SELECT CAST('x' AS SIGNED); SHOW WARNINGS;returned0and anINTEGERwarning with code1292on both servers. - Valid-value control:
CAST('42' AS SIGNED)returned42;CAST(NULL AS SIGNED)returnedNULL. - Only the literal
SIGNEDprefix case was compared here.UNSIGNEDnumeric-prefix values, column values, and prepared/binary-protocol execution remain untested.
Evidence
MatrixOne: 42; Warning 1292: Truncated incorrect DOUBLE value: '42tail'
MySQL: 42; Warning 1292: Truncated incorrect INTEGER value: '42tail'
The full verification and environment record is in #30417's regression comment.
Code analysis
At the tested commit, the signed string-cast path in func_cast.go can call appendNumericCoercionWarning, which formats a DOUBLE diagnostic. The explicit integer-warning helper in the same file formats INTEGER.
This is a candidate explanation based on static inspection; the specific runtime branch for this query has not been traced.
Regression coverage
If diagnostic text is confirmed as in scope:
- Assert the value, warning code, and warning message for a
SIGNEDnumeric-prefix literal. - Retain valid,
NULL, and wholly invalid-text controls. - Check
UNSIGNED, column-driven values, and prepared/text versus binary protocol independently before claiming those paths are covered.
Related
- [Compatibility]: CAST('x' AS SIGNED) returns error 20203 (MySQL returns 0) #30417 tracks the original invalid-text conversion failure and its consolidated explicit-cast checks.
- [Compatibility]: Built-in integer arguments omit MySQL warnings for malformed strings #30218 covers omitted warnings for integer arguments of built-in functions; it does not describe this explicit
CASTwarning-text mismatch. - [Compatibility]: strict INSERT with invalid DECIMAL cast returns 20301/HY000 instead of MySQL 1292/22007 #31444 tracks a separate strict-
DECIMALDML error-code/SQLSTATE difference.
Activity
fix(function): name INTEGER in explicit CAST(text AS SIGNED/UNSIGNED)…
Ariznawlll commentedon Nov 29, 2026
结论
测试通过。CAST 数字前缀文本 AS SIGNED 的警告已正确使用 INTEGER,同时保持结果与 1292 错误码;列输入、UNSIGNED 和真实二进制预编译也已覆盖。
关键证据
版本与环境
922815d74fe664dc9f4ea7bfc4c4e8ac3b279cd0;本次 Linux CI 从官方 main 检出的实际版本为231b68c2d6421e9d212538866e0f825afd6c13e8,两处分别核对完整git_version()。CI 比本地多了 Release merge spill buffers on panic #32160,核对差异仅为 spill sinker 及其两个测试文件。以下 CI 的正式 SQL、SDK 和源码测试确实在 CI 版本上重新执行;不把 MOTR commit 当作 MO 版本,也不将 main 结果外推为 4.2-dev 通过。步骤、断言与实际结果
TestExplicitCastTextToIntegerWarnsInteger原生三轮通过。回归与 CI
qa-acceptance-main中版本、正式结果、原生测试和 SDK 日志。本轮整体正式 MOTR 63/63(21 个用例各三轮)、0 失败;63 次不全属于本 Issue。待解决点
本 Issue 上述原始问题与相关边界没有未通过项。该结论不扩展为其他 Issue、大数据性能或未执行的生产拓扑验收。MOTR 回归已经提交,按用户允许先验收关闭、随后合入 PR 的流程处理。
最终结论:测试通过。原始复现、上述扩展、对应 MOTR 回归及 Linux CI 均已完成;本 Issue 验收范围内未通过项:无。按授权关闭 #31443。