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
[Bug]: date/time functions error on zero or invalid date strings instead of MySQL NULL/0 semantics #25306
Latest origin/main verified locally at 200bfa7e0efb.
Reproduce Steps
set session sql_mode ='';
select date_format('0000-00-00', '%Y-%m-%d') as zero_fmt,
dayofmonth('0000-00-00') as zero_day,
month('0000-00-00') as zero_month,
year('0000-00-00') as zero_year,
last_day('2024-02-31') as invalid_last_day;
select extract(month from'0000-00-00') as zero_extract_month,
extract(day from'not-a-date') as invalid_extract_day;
select convert_tz('2024-01-01 00:00:00', '+00:00', '+08:00') as offset_ok,
convert_tz('invalid', '+00:00', '+08:00') as invalid_dt;
Expected Behavior
MySQL returns zero parts for extractor-style functions that accept incomplete dates, and returns NULL for invalid complete-date operations:
This is separate from #25253, which covers CAST('0000-00-00 00:00:00' AS DATETIME). This issue is about date/time function behavior for zero/incomplete/invalid date strings.
MySQL documentation says some date functions work with zero or incomplete dates and return zero parts, while functions expecting complete dates return NULL for invalid/incomplete values.
在 main@33af6ae3c0c23e4f277137460577ea64678f7ecf 上,date('0000-00-00') 的零日期分支仍返回 NULL/0 混合结果;date('2024-02-30') 及相关无效日期表达式稳定返回 data out of range 错误,而不是按 issue 中的 MySQL 兼容 NULL/零部件语义完成查询。该结果来自 ODBC 和原始 MySQL 文本协议交叉测试。
QA handoff after merged PR #28851 (merge a99db843c7b4630a86883addc9424433d93fc2d2). This issue was a non-closing related report; the merge and shared BVT counts are not an independent PASS for this reproducer.
Latest MatrixOne contract: C05, C16–C17, C30–C31 in the merged temporal design. Accepted zero-calendar raw YEAR/MONTH/DAY/DAYOFMONTH and EXTRACT fields are zero in either SQL mode; explicit DATE conversion observes NO_ZERO_DATE. Malformed tolerant temporal input is NULL, while zero/partial-zero calendar policies remain distinct. The merged contract does not automatically settle LAST_DAY or CONVERT_TZ.
Please rerun the original reproducer on main at or after the merge and record the exact SHA, deployment, SQL mode/time zone, client path, observed rows/types/NULLs and active warnings or errors. Rerun all three original statements under both modes, including LAST_DAY and CONVERT_TZ controls; close only if every issue-specific function satisfies its declared contract, otherwise document the residual path.
Keep the issue open until the issue-specific acceptance is demonstrated with happy and unhappy controls. If any part still fails, post the exact observed-versus-expected result and return it to development; if it passes, record evidence and close the issue. @Ariznawlll
Activity
iamlinjunhong commentedon Sep 1, 2026
最新 main 复测(2026-09-01)
在
main@33af6ae3c0c23e4f277137460577ea64678f7ecf上,date('0000-00-00')的零日期分支仍返回 NULL/0 混合结果;date('2024-02-30')及相关无效日期表达式稳定返回data out of range错误,而不是按 issue 中的 MySQL 兼容 NULL/零部件语义完成查询。该结果来自 ODBC 和原始 MySQL 文本协议交叉测试。fix: align date compatibility semantics (#28851)
XuPeng-SH commentedon Sep 27, 2026
QA handoff after merged PR #28851 (merge
a99db843c7b4630a86883addc9424433d93fc2d2). This issue was a non-closing related report; the merge and shared BVT counts are not an independent PASS for this reproducer.Latest MatrixOne contract: C05, C16–C17, C30–C31 in the merged temporal design. Accepted zero-calendar raw YEAR/MONTH/DAY/DAYOFMONTH and EXTRACT fields are zero in either SQL mode; explicit DATE conversion observes NO_ZERO_DATE. Malformed tolerant temporal input is NULL, while zero/partial-zero calendar policies remain distinct. The merged contract does not automatically settle LAST_DAY or CONVERT_TZ.
Please rerun the original reproducer on
mainat or after the merge and record the exact SHA, deployment, SQL mode/time zone, client path, observed rows/types/NULLs and active warnings or errors. Rerun all three original statements under both modes, including LAST_DAY and CONVERT_TZ controls; close only if every issue-specific function satisfies its declared contract, otherwise document the residual path.Keep the issue open until the issue-specific acceptance is demonstrated with happy and unhappy controls. If any part still fails, post the exact observed-versus-expected result and return it to development; if it passes, record evidence and close the issue. @Ariznawlll
Ariznawlll commentedon Oct 2, 2026
测试版本
maind50a2d475a406829f67127fef7b2ad4abc1c1d3dmo-service,独立数据目录;MySQL 文本协议与 server-side PREPARE原问题验证
按 issue 原始语义在上述 commit 重新执行并重复 3 次。零日期的 YEAR/MONTH/DAY/EXTRACT 按约定返回 0;非法日历输入返回 NULL,不再中断查询。
Happy Path 覆盖
覆盖零日期、partial-zero 与普通有效日期,结果与最新 temporal contract 一致。
Unhappy Path 覆盖
覆盖非法日期文本、NO_ZERO_DATE 模式及 NULL 输入;均返回受控 NULL/诊断,无内部错误。
白盒验证
关联修复 #28851 已进入当前
main。同时将本 issue 的可公开观察契约固化为独立回归,避免只依赖实现细节或共享测试间接判断。回归测试
suites/14_issue_regression/t/issue_recent_temporal_contracts.test714/714条语句通过。测试证据
d50a2d475a406829f67127fef7b2ad4abc1c1d3d14_issue_regression中观察到的旧 GOROOT/历史 golden/并发锁冲突属于既有无关失败,以上新增用例单独重跑均稳定通过。测试结论
测试通过。