Skip to content

Commit cd7ec6c

Browse files
committed
Allow "type" to be used as identifier in PostgreSQL
Fixes #685
1 parent 7e3db7f commit cd7ec6c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/languages/postgresql/postgresql.formatter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const onelineClauses = expandPhrases([
5252
'ADD [COLUMN] [IF NOT EXISTS]',
5353
'DROP [COLUMN] [IF EXISTS]',
5454
'ALTER [COLUMN]',
55-
'[SET DATA] TYPE', // for alter column
55+
'SET DATA TYPE', // for alter column
5656
'{SET | DROP} DEFAULT', // for alter column
5757
'{SET | DROP} NOT NULL', // for alter column
5858
// - truncate:

test/postgresql.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,4 +301,15 @@ describe('PostgreSqlFormatter', () => {
301301
tbl.salary;
302302
`);
303303
});
304+
305+
// Issue #685
306+
it('allows TYPE to be used as an identifier', () => {
307+
expect(format(`SELECT type, modified_at FROM items;`)).toBe(dedent`
308+
SELECT
309+
type,
310+
modified_at
311+
FROM
312+
items;
313+
`);
314+
});
304315
});

0 commit comments

Comments
 (0)