Skip to content

Commit

Permalink
Format DEFAULT VALUES clause for Postgres (#720)
Browse files Browse the repository at this point in the history
Closes #718.
  • Loading branch information
nene authored Feb 20, 2024
2 parents 3483499 + 34eeed7 commit e2bb28b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/languages/postgresql/postgresql.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const reservedClauses = expandPhrases([
// - insert:
'INSERT INTO',
'VALUES',
'DEFAULT VALUES',
// - update:
'SET',
// other
Expand Down
14 changes: 14 additions & 0 deletions test/postgresql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,4 +331,18 @@ describe('PostgreSqlFormatter', () => {
release;
`);
});

it('formats DEFAULT VALUES clause', () => {
expect(
format(`INSERT INTO items default values RETURNING id;`, {
keywordCase: 'upper',
})
).toBe(dedent`
INSERT INTO
items
DEFAULT VALUES
RETURNING
id;
`);
});
});

0 comments on commit e2bb28b

Please sign in to comment.