Skip to content

Support underscores in Trino numeric literals - #994

Open
mosabua wants to merge 1 commit into
sql-formatter-org:masterfrom
mosabua:trino-underscores-in-numbers
Open

mosabua wants to merge 1 commit into
sql-formatter-org:masterfrom
mosabua:trino-underscores-in-numbers

Conversation

@mosabua

@mosabua mosabua commented Oct 15, 2026

Copy link
Copy Markdown

Trino accepts underscores as digit separators in numeric literals, for example
1_000_000 or 123_456.789_123, as described in the
Trino data types documentation.
The Trino dialect did not enable underscoresInNumbers, so formatting such a
query failed:

Parse error: Unexpected "1_000_000" at line 1 column 8.
SQL dialect used: "trino".

Changes:

  • Enable underscoresInNumbers in the Trino dialect, as the DuckDB,
    PostgreSQL, and ClickHouse dialects already do.
  • Run the shared underscore number test for Trino.

Found while testing the format action of the
Trino query editor, which uses
sql-formatter with the Trino dialect.

Trino accepts underscores as digit separators, for example 1_000_000,
but the Trino dialect rejected them with a parse error.
@mosabua
mosabua force-pushed the trino-underscores-in-numbers branch from 7fc0fee to dc6bec6 Compare October 15, 2026 06:10
@mosabua
mosabua marked this pull request as ready for review October 16, 2026 03:50

This branch has not been deployed

No deployments
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.

1 participant