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
[Compatibility]: MAKEDATE truncates exact DECIMAL arguments instead of rounding #28495
MAKEDATE truncates exact DECIMAL year/day-of-year arguments to integers. MySQL rounds exact numeric arguments during integer conversion, so values with a fractional part of .5 or greater select a different year or day.
This issue is separate from #28493, which covers the function's incorrect VARCHAR return domain.
The DECIMAL behavior was reproduced three times through:
exact DECIMAL constants around .4, .5, and .9 boundaries;
DECIMAL year and day-of-year columns;
SQL prepared statement parameters;
CTAS, which persists the earlier date.
Integer and NULL controls behave normally. FLOAT/DOUBLE and character inputs are intentionally excluded from the compatibility claim because MySQL itself has path-dependent conversion behavior for those domains; this issue is limited to the stable exact-DECIMAL contract.
Code analysis
MAKEDATE registers both parameters as VARCHAR, so DECIMAL inputs are converted to text. MakeDateString in pkg/sql/plan/function/func_binary.go then falls back from ParseInt to ParseFloat and converts with int64(...):
The same logic is used for the day argument. The direct float-to-int conversion truncates toward zero and also unnecessarily loses the exact DECIMAL domain before conversion.
The issue's exact DECIMAL cases were rerun against the local MatrixOne service source commit 2ce4e58af6f03b943ee288ffad81012766cf830a and live MySQL 8.0.45. The previously reported differences did not reproduce:
DECIMAL day arguments 1.4, 1.5, 1.9 and year-end 365.5 return the same dates in both engines.
DECIMAL year 2024.4, 2024.5, and 2024.9 return the same dates.
The same values from DECIMAL table columns and SQL PREPARE/EXECUTE parameters also match.
All listed cases matched in 3/3 runs; valid integer controls matched.
This is runtime evidence only; I have not changed the issue state.
Activity
Ariznawlll commentedon Oct 14, 2026
Current service recheck (2026-10-15)
The issue's exact DECIMAL cases were rerun against the local MatrixOne service source commit
2ce4e58af6f03b943ee288ffad81012766cf830aand live MySQL 8.0.45. The previously reported differences did not reproduce:1.4,1.5,1.9and year-end365.5return the same dates in both engines.2024.4,2024.5, and2024.9return the same dates.PREPARE/EXECUTEparameters also match.This is runtime evidence only; I have not changed the issue state.
jiangxinmeng1 commentedon Oct 22, 2026
已在远程机器 [email protected] 对 clean main(a949c88af0ed)运行 MAKEDATE 精确 DECIMAL 参数的 SQL 复现,舍入行为通过;该 issue 已修复。转给 Ariznawlll 跟进。
Ariznawlll commentedon Oct 22, 2026
测试版本
cca94b810ce87a38d1af16d7b418ea727eeda81c(包含已合入修复 fix remaining date/time compatibility issues #28932 的 merge commit)原问题验证
精确 DECIMAL 输入 1.4/1.5/1.9 分别得到 2024-01-01/02/02,
MAKEDATE(2024.5,1)=2025-01-01;表列(2024.5,1.5)得到 2025-01-02。 独立启动环境重复 3/3 轮通过,未用开发者自测代替 QA。Happy Path 覆盖
365.5 -> 2024-12-31均与预期一致。Unhappy Path 覆盖
白盒验证
本轮未单独跑 Go UT / race;本问题为确定性 SQL 值或类型路径,以真实协议黑盒及 SQL 回归验收。完整 MatrixOne suite 未执行。
回归测试
--repeat 3通过。PR 当前仍 Open,尚未声称已合并或 CI 全绿。测试证据
上述 PR 的成对 t/r、实际 main SHA,以及本地
go test ./pkg/tests/issues -run '^TestQATemporalScreenshot20261022$' -count=3与 MOTR 定向--repeat 3均通过;黑盒临时测试仅用于本次独立验收,未作为持久产品代码提交。测试结论
测试通过。