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]: WEEK(date) single-argument form ignores @@default_week_format, always uses mode=1 #24293
WEEK(date) without the mode argument always returns the result corresponding to mode=1 (week starts on Monday), regardless of the value of @@default_week_format.
mysql>SELECT @@default_week_format;
-- 0
mysql>SELECT WEEK('2026-05-07');
-- MO returns: 19 (this is the mode=1 result)
mysql>SELECT WEEK('2026-05-07', 0);
-- MO returns: 18 (correct)
mysql>SELECT WEEK('2026-05-07', 1);
-- MO returns: 19 (correct)
Additionally, WEEK(date) and YEARWEEK(date) are inconsistent with each other:
mysql>SELECT WEEK('2026-05-07'), YEARWEEK('2026-05-07');
-- MO: 19, 202618-- WEEK uses mode=1, YEARWEEK uses mode=0 — these should use the same default
Expected Behavior
Per MySQL documentation: "If the mode argument is omitted, the value of the default_week_format system variable is used."
SELECT @@default_week_format;
-- Returns 0SELECT WEEK('2026-05-07');
-- Returns 19 (wrong, should be 18)SELECT WEEK('2026-05-07', 0);
-- Returns 18 (correct)
Additional information
This was discovered while verifying the fix for #24236 (WEEK two-argument form). The two-argument form is now correct for all modes 0-7. Only the single-argument form has this default mode issue.
Activity
Ariznawlll commentedon May 7, 2026
验证结果:已修复 ✅
在最新代码上验证,
WEEK(date)单参数形式已正确使用@@default_week_format:WEEK('2026-05-07')返回 18,与WEEK('2026-05-07', 0)一致,说明已正确使用 mode=0(default_week_format 默认值),与 MySQL 行为对齐。Ariznawlll commentedon May 7, 2026
验证分支/commit: 3.0-dev @ f9f1981 (fix: close interval and week compatibility gaps #24302)
版本信息: 8.0.30-MatrixOne-v3.0
test(function): update test cases for matrixorigin#24293 matrixorigin…