Skip to content

Commit eb692ef

Browse files
committed
Remove DO from list of onelineClauses
1 parent 2b430c7 commit eb692ef

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

src/languages/mariadb/mariadb.formatter.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ const onelineClauses = expandPhrases([
9292
'CREATE USER',
9393
'DEALLOCATE PREPARE',
9494
'DESCRIBE',
95-
'DO',
9695
'DROP DATABASE',
9796
'DROP EVENT',
9897
'DROP FUNCTION',

src/languages/mysql/mysql.formatter.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ const onelineClauses = expandPhrases([
8787
'CREATE USER',
8888
'DEALLOCATE PREPARE',
8989
'DESCRIBE',
90-
'DO',
9190
'DROP DATABASE',
9291
'DROP EVENT',
9392
'DROP FUNCTION',

src/languages/postgresql/postgresql.formatter.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ const onelineClauses = expandPhrases([
150150
'DEALLOCATE',
151151
'DECLARE',
152152
'DISCARD',
153-
'DO',
154153
'DROP ACCESS METHOD',
155154
'DROP AGGREGATE',
156155
'DROP CAST',

src/languages/singlestoredb/singlestoredb.formatter.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ const onelineClauses = expandPhrases([
8989
'DESCRIBE',
9090
'DETACH DATABASE',
9191
'DETACH PIPELINE',
92-
'DO',
9392
'DROP DATABASE',
9493
'DROP FUNCTION',
9594
'DROP INDEX',

test/behavesLikeMariaDbFormatter.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,14 @@ export default function behavesLikeMariaDbFormatter(format: FormatFn) {
116116
(2, 'Dog');
117117
`);
118118
});
119+
120+
// Regression test for issue #535
121+
it('gracefully handles ON CONFLICT .. DO syntax', () => {
122+
expect(format(`INSERT INTO tbl VALUES (1,'Blah') ON CONFLICT DO NOTHING;`)).toBe(dedent`
123+
INSERT INTO
124+
tbl
125+
VALUES
126+
(1, 'Blah') ON CONFLICT DO NOTHING;
127+
`);
128+
});
119129
}

0 commit comments

Comments
 (0)