Skip to content

Commit

Permalink
Don't detect CHAR as function (only as data-type)
Browse files Browse the repository at this point in the history
Fixes #811
  • Loading branch information
nene committed Dec 21, 2024
1 parent 16863c5 commit badf398
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/languages/transactsql/transactsql.functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ export const functions: string[] = [

// string
'ASCII',
'CHAR',
'CHARINDEX',
'CONCAT',
'CONCAT_WS',
Expand All @@ -243,7 +242,6 @@ export const functions: string[] = [
'LEN',
'LOWER',
'LTRIM',
'NCHAR',
'PATINDEX',
'QUOTENAME',
'REPLACE',
Expand Down
7 changes: 7 additions & 0 deletions test/transactsql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
`);
});
});

0 comments on commit badf398

Please sign in to comment.