From dc6bec6fe96ff8a05f3d948e5a6c0c70cd5fa1b4 Mon Sep 17 00:00:00 2001 From: Manfred Moser Date: Wed, 14 Oct 2026 22:44:25 -0700 Subject: [PATCH] Support underscores in Trino numeric literals Trino accepts underscores as digit separators, for example 1_000_000, but the Trino dialect rejected them with a parse error. --- src/languages/trino/trino.formatter.ts | 2 ++ test/trino.test.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/languages/trino/trino.formatter.ts b/src/languages/trino/trino.formatter.ts index bcb9d54dc1..9fe0488d60 100644 --- a/src/languages/trino/trino.formatter.ts +++ b/src/languages/trino/trino.formatter.ts @@ -155,6 +155,8 @@ export const trino: DialectOptions = { // https://trino.io/docs/current/language/reserved.html identTypes: ['""-qq'], paramTypes: { positional: true }, + // https://trino.io/docs/current/language/types.html#integer + underscoresInNumbers: true, operators: [ '%', '->', diff --git a/test/trino.test.ts b/test/trino.test.ts index f546ebe485..f397f883d1 100644 --- a/test/trino.test.ts +++ b/test/trino.test.ts @@ -33,7 +33,7 @@ describe('TrinoFormatter', () => { const format: FormatFn = (query, cfg = {}) => originalFormat(query, { ...cfg, language }); behavesLikeSqlFormatter(format); - supportsNumbers(format); + supportsNumbers(format, { underscore: true }); supportsComments(format); supportsCommentOn(format); supportsCreateView(format, { orReplace: true, materialized: true });