diff --git a/src/languages/db2/db2.formatter.ts b/src/languages/db2/db2.formatter.ts index c1c3e79829..002df6a400 100644 --- a/src/languages/db2/db2.formatter.ts +++ b/src/languages/db2/db2.formatter.ts @@ -189,7 +189,7 @@ export const db2: DialectOptions = { { quote: "''-raw", prefixes: ['X', 'BX', 'GX', 'UX'], requirePrefix: true }, ], identTypes: [`""-qq`], - identChars: { first: '@#$' }, + identChars: { first: '@#$', rest: '@#$' }, paramTypes: { positional: true, named: [':'] }, paramChars: { first: '@#$', rest: '@#$' }, operators: ['**', '¬=', '¬>', '¬<', '!>', '!<', '||'], diff --git a/src/languages/db2i/db2i.formatter.ts b/src/languages/db2i/db2i.formatter.ts index 02fe16e925..79a900077b 100644 --- a/src/languages/db2i/db2i.formatter.ts +++ b/src/languages/db2i/db2i.formatter.ts @@ -168,7 +168,7 @@ export const db2i: DialectOptions = { { quote: "''-raw", prefixes: ['X', 'BX', 'GX', 'UX'], requirePrefix: true }, ], identTypes: [`""-qq`], - identChars: { first: '@#$' }, + identChars: { first: '@#$', rest: '@#$' }, paramTypes: { positional: true }, operators: ['**', '¬=', '¬>', '¬<', '!>', '!<', '||'], }, diff --git a/test/behavesLikeDb2Formatter.ts b/test/behavesLikeDb2Formatter.ts index 53d4f47a4c..422816e98f 100644 --- a/test/behavesLikeDb2Formatter.ts +++ b/test/behavesLikeDb2Formatter.ts @@ -83,12 +83,15 @@ export default function behavesLikeDb2Formatter(format: FormatFn) { `); }); - it('supports @, #, $ characters at the start of identifiers', () => { - expect(format(`SELECT @foo, #bar, $zap`)).toBe(dedent` + it('supports @, #, $ characters anywhere inside identifiers', () => { + expect(format(`SELECT @foo, #bar, $zap, fo@o, ba#2, za$3`)).toBe(dedent` SELECT @foo, #bar, - $zap + $zap, + fo@o, + ba#2, + za$3 `); });