Skip to content

[Compatibility]: FORMAT locale lookup is case-sensitive and silently falls back to en_US #28480

Closed

Description

@Ariznawlll

Is there an existing issue for the same bug?

  • I have checked open and closed issues.

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:

SELECT FORMAT(1234.56, 2, 'de_DE'),
       FORMAT(1234.56, 2, 'de_de'),
       FORMAT(1234.56, 2, 'DE_DE'),
       FORMAT(1234.56, 2, 'fr_fr');

MatrixOne:

1.234,56 | 1,234.56 | 1,234.56 | 1,234.56

MySQL 8.3:

1.234,56 | 1.234,56 | 1.234,56 | 1234,56

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');

CREATE DATABASE codex_format_locale_case;
USE codex_format_locale_case;
CREATE TABLE src(id INT PRIMARY 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

  1. added this to the MO-202609 milestone on Sep 9, 2026
  2. added theissue type on Sep 9, 2026
  3. self-assigned this
    on Sep 9, 2026
  4. added a commit that references this issue on Sep 10, 2026
    1603316
  5. Ariznawlll commented on Sep 10, 2026

    @Ariznawlll
    CollaboratorAuthor

    测试版本

    • 分支:main
    • commit:fc621e3616d229c7a29d0c80e73ed8eb1997459c
    • 部署方式:本地单机 1 Log / 1 TN / 1 CN
    • 测试日期:2026-09-10

    原问题验证

    de_de、DE_DE、De_dE 连续 3 次均返回 1.234,56;fr_fr、FR_FR 均返回 1234,56,不再静默回退为 en_US。

    Happy Path 覆盖

    1. locale VARCHAR 列覆盖 de_de、DE_DE、fr_fr 与 canonical de_DE,结果均使用正确 locale 格式。
    2. SQL 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 次通过。

    测试证据

    • 本地构建二进制的 Git commit 为 fc621e3616。
    • 回归提交:1cc567ea。

    测试结论

    测试通过。

  6. added 3 commits that reference this issue on Sep 17, 2026
    ef793b0
    79163fe
    7a03d78
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/compatibilitykind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions