ITADN

sqlfmt adds a space into ClickHouse numeric literal if it contains an underscore

#716Closedhai-ld 创建于 2025-10-21
bug
H
hai-ldcommented
**Describe the bug** ClickHouse (and PostgreSQL AFAIK) supports [using underscores `_` as thousand separator](https://clickhouse.com/docs/sql-reference/syntax#numeric) (they basically just ignore them), but sqlfmt handles numerics with underscores rather destructively. **To Reproduce** Given the query ```sql select 1_000_000 ``` which returns 1000000, sqlfmt will format it to ```sql select 1 _000_000 ``` which returns 1. **Expected behavior** sqlfmt should keep the literal as-is. **Actual behavior** sqlfmt adds a space into the literal and changes the semantic of the query. **Additional context** I'm using sqlfmt via pre-commit with the following configuration ```yaml - repo: https://github.com/tconbeer/sqlfmt rev: v0.27.0 hooks: - id: sqlfmt language_version: python args: ["--dialect", "clickhouse"] additional_dependencies: ['.[jinjafmt]'] ``` What is the output of `pip list` (or `pipx list` if you installed using pipx)? N/A
关闭于 2025-10-22 1 条评论