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]: FORMAT locale lookup is case-sensitive and silently falls back to en_US #28480
No issue describes case-sensitive locale lookup in FORMAT(). #28478 concerns the different grouping algorithm required by three Indian locales, not locale-name normalization.
Branch Name
main
Commit ID
f0c31cd4b830be32442cf329e0a3fb08aa9c16c3
Other Environment Information
Local standalone MatrixOne built from the commit above
Reference: MySQL 8.3.0
Actual Behavior
MatrixOne recognizes FORMAT() locale names only with the exact casing used by its internal map. Other casing silently falls back to en_US:
Mixed casing such as De_dE behaves the same way. The difference reproduces with literals/user variables, locale names read from a VARCHAR column, and SQL PREPARE parameters; every form was executed three times.
Expected Behavior
Locale lookup should be case-insensitive, matching MySQL, while preserving the formatting rules of the resolved locale.
Steps to Reproduce
SELECT FORMAT(1234.56, 2, 'de_de');
SELECT FORMAT(1234.56, 2, 'DE_DE');
SELECT FORMAT(1234.56, 2, 'De_dE');
SELECT FORMAT(1234.56, 2, 'fr_fr');
SELECT FORMAT(1234.56, 2, 'FR_FR');
CREATEDATABASEcodex_format_locale_case;
USE codex_format_locale_case;
CREATETABLEsrc(id INTPRIMARY KEY, loc VARCHAR(10));
INSERT INTO src VALUES (1,'de_de'),(2,'DE_DE'),(3,'fr_fr'),(4,'de_DE');
SELECT id, loc, FORMAT(1234.56, 2, loc) FROM src ORDER BY id;
PREPARE p FROM'SELECT FORMAT(1234.56, 2, ?)';
SET @loc ='de_de';
EXECUTE p USING @loc;
DEALLOCATE PREPARE p;
Controls
The canonical spellings de_DE and fr_FR match MySQL. en_US and EN_US appear equal only because the case-mismatched form falls back to the same en_US output, so a non-default locale is required to expose the defect.
Root Cause
pkg/vectorize/format/format.go indexes localeToFormatFunction with the raw locale string. The map contains only canonical-case keys; a lookup miss returns formatENUS without normalizing case.
Activity
fix(sql): harden FORMAT numeric and locale handling (#28508)
Ariznawlll commentedon Sep 10, 2026
测试版本
mainfc621e3616d229c7a29d0c80e73ed8eb1997459c1 Log / 1 TN / 1 CN原问题验证
de_de、DE_DE、De_dE连续 3 次均返回1.234,56;fr_fr、FR_FR均返回1234,56,不再静默回退为en_US。Happy Path 覆盖
VARCHAR列覆盖de_de、DE_DE、fr_fr与 canonicalde_DE,结果均使用正确 locale 格式。PREPARE/EXECUTE的de_de返回1.234,56;en_US控制组仍为1,234.56。Unhappy Path 覆盖
大小写非 canonical 名称是本 issue 的原异常输入,现均被正常归一化;执行后 fixture 仍为 6 行,未发生 fallback 污染或中断。
白盒验证
修复 PR matrixone#28508 已合入;
pkg/vectorize/format定向单测通过。回归测试
已加入 MOTR PR #153:
issue_28213_28475_28476_28478_28480_format_compatibility.test,连续 3 次通过。测试证据
fc621e3616。测试结论
测试通过。
fix(sql): harden FORMAT numeric and locale handling (matrixorigin#28508)
fix(sql): harden FORMAT numeric and locale handling (matrixorigin#28508)
fix(sql): harden FORMAT numeric and locale handling (matrixorigin#28508)