Skip to content

Commit e2bb28b

Browse files
authored
Format DEFAULT VALUES clause for Postgres (#720)
Closes #718.
2 parents 3483499 + 34eeed7 commit e2bb28b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/languages/postgresql/postgresql.formatter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const reservedClauses = expandPhrases([
2323
// - insert:
2424
'INSERT INTO',
2525
'VALUES',
26+
'DEFAULT VALUES',
2627
// - update:
2728
'SET',
2829
// other

test/postgresql.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,4 +331,18 @@ describe('PostgreSqlFormatter', () => {
331331
release;
332332
`);
333333
});
334+
335+
it('formats DEFAULT VALUES clause', () => {
336+
expect(
337+
format(`INSERT INTO items default values RETURNING id;`, {
338+
keywordCase: 'upper',
339+
})
340+
).toBe(dedent`
341+
INSERT INTO
342+
items
343+
DEFAULT VALUES
344+
RETURNING
345+
id;
346+
`);
347+
});
334348
});

0 commit comments

Comments
 (0)