From badf398bea1ecbed6a2f36e0735cc3afab0a3230 Mon Sep 17 00:00:00 2001 From: Rene Saarsoo Date: Sat, 21 Dec 2024 11:26:39 +0200 Subject: [PATCH] Don't detect CHAR as function (only as data-type) Fixes #811 --- src/languages/transactsql/transactsql.functions.ts | 2 -- test/transactsql.test.ts | 7 +++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/languages/transactsql/transactsql.functions.ts b/src/languages/transactsql/transactsql.functions.ts index 326a2cb995..41078a7293 100644 --- a/src/languages/transactsql/transactsql.functions.ts +++ b/src/languages/transactsql/transactsql.functions.ts @@ -233,7 +233,6 @@ export const functions: string[] = [ // string 'ASCII', - 'CHAR', 'CHARINDEX', 'CONCAT', 'CONCAT_WS', @@ -243,7 +242,6 @@ export const functions: string[] = [ 'LEN', 'LOWER', 'LTRIM', - 'NCHAR', 'PATINDEX', 'QUOTENAME', 'REPLACE', diff --git a/test/transactsql.test.ts b/test/transactsql.test.ts index 655a88f106..0fe818a84f 100644 --- a/test/transactsql.test.ts +++ b/test/transactsql.test.ts @@ -190,4 +190,11 @@ describe('TransactSqlFormatter', () => { GOTO InfiniLoop; `); }); + + // Issue #811 + it('does not detect CHAR() as function', () => { + expect(format(`CREATE TABLE foo (name char(65));`, { functionCase: 'upper' })).toBe(dedent` + CREATE TABLE foo (name char(65)); + `); + }); });