Skip to content

Commit 2edffbe

Browse files
committed
Format COMMENT ON as keywords
Refs #924
1 parent f676e37 commit 2edffbe

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/languages/postgresql/postgresql.formatter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ const tabularOnelineClauses = expandPhrases([
112112
'CHECKPOINT',
113113
'CLOSE',
114114
'CLUSTER',
115+
'COMMENT ON',
115116
'COMMIT',
116117
'COMMIT PREPARED',
117118
'COPY',

test/postgresql.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,4 +243,11 @@ describe('PostgreSqlFormatter', () => {
243243
})
244244
).toBe(dedent`CREATE TABLE foo (id UUID DEFAULT gen_random_uuid());`);
245245
});
246+
247+
// Issue #924
248+
it('formats keywords in COMMENT ON', () => {
249+
expect(format(`comment on table foo is 'Hello my table';`, { keywordCase: 'upper' })).toBe(
250+
dedent`COMMENT ON TABLE foo IS 'Hello my table';`
251+
);
252+
});
246253
});

0 commit comments

Comments
 (0)