Skip to content

fix: cast numeric FORMAT arguments for DuckDB - #479

Open
weicao wants to merge 1 commit into
mainfrom
compat/format-cast
Open

fix: cast numeric FORMAT arguments for DuckDB#479
weicao wants to merge 1 commit into
mainfrom
compat/format-cast

Conversation

@weicao

@weicao weicao commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Scope

Fix MySQL FORMAT(x, d[, locale]) when x is an integer. DuckDB rejects precision format specifiers for integer arguments, while MySQL accepts them. The translator now casts the value to DOUBLE before formatting.

Evidence

  • Base exact main: 749b616
  • Baseline: integer FORMAT subtests fail with precision not allowed for this argument type.
  • Patched: 4 FORMAT TestQueriesSimple subtests pass, including da_DK locale variants.
  • go test ./transpiler passes.
  • No JSON, HAVING, dependency, image, or version changes.

Please platform-sign the replacement head before review. Do not merge or change release tags from this PR.

@weicao
weicao force-pushed the compat/format-cast branch from 22a0d85 to be3522f Compare August 23, 2026 15:05
Preserve integer and DECIMAL precision while translating MySQL FORMAT.

Generated through the GitHub platform commit API.
@weicao
weicao force-pushed the compat/format-cast branch from be3522f to e5b396c Compare August 23, 2026 16:03

@leon-ape leon-ape left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent review of exact platform-signed head e5b396c.

  • GitHub web-flow verified; unique parent is exact main 749b616; tree ae59af41133032963be2e93a1c62c0fd9e401073.
  • Scope is exactly three files: transpiler/translate.go, transpiler/translate_test.go, format_precision_test.go.
  • go test ./transpiler -count=3 passed.
  • Four TestQueriesSimple FORMAT cases passed 3 consecutive runs.
  • TestFormatPreservesNumericPrecision passed 3 consecutive runs, including 9007199254740993 and 30-digit DECIMAL. Additional negative DECIMAL, locale, string, NULL, and dynamic-digit probes passed.
  • Parent/head TestQueriesSimple comparison removed only the two intended integer FORMAT failures and introduced no new failure.

The remaining Go/binlog/Postgres CI failures match known parent baseline differences outside these files. No merge or image action performed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants