Skip to content

Commit 5a3f193

Browse files
authored
Fix extra whitespace printed before ON CONFLICT (#1037)
1 parent c887c4e commit 5a3f193

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/ast/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3513,7 +3513,7 @@ impl fmt::Display for OnInsert {
35133513
" ON DUPLICATE KEY UPDATE {}",
35143514
display_comma_separated(expr)
35153515
),
3516-
Self::OnConflict(o) => write!(f, " {o}"),
3516+
Self::OnConflict(o) => write!(f, "{o}"),
35173517
}
35183518
}
35193519
}

tests/sqlparser_postgres.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,7 +1428,7 @@ fn parse_prepare() {
14281428
fn parse_pg_on_conflict() {
14291429
let stmt = pg_and_generic().verified_stmt(
14301430
"INSERT INTO distributors (did, dname) \
1431-
VALUES (5, 'Gizmo Transglobal'), (6, 'Associated Computing, Inc') \
1431+
VALUES (5, 'Gizmo Transglobal'), (6, 'Associated Computing, Inc') \
14321432
ON CONFLICT(did) \
14331433
DO UPDATE SET dname = EXCLUDED.dname",
14341434
);
@@ -1458,7 +1458,7 @@ fn parse_pg_on_conflict() {
14581458

14591459
let stmt = pg_and_generic().verified_stmt(
14601460
"INSERT INTO distributors (did, dname, area) \
1461-
VALUES (5, 'Gizmo Transglobal', 'Mars'), (6, 'Associated Computing, Inc', 'Venus') \
1461+
VALUES (5, 'Gizmo Transglobal', 'Mars'), (6, 'Associated Computing, Inc', 'Venus') \
14621462
ON CONFLICT(did, area) \
14631463
DO UPDATE SET dname = EXCLUDED.dname, area = EXCLUDED.area",
14641464
);
@@ -1497,7 +1497,7 @@ fn parse_pg_on_conflict() {
14971497

14981498
let stmt = pg_and_generic().verified_stmt(
14991499
"INSERT INTO distributors (did, dname) \
1500-
VALUES (5, 'Gizmo Transglobal'), (6, 'Associated Computing, Inc') \
1500+
VALUES (5, 'Gizmo Transglobal'), (6, 'Associated Computing, Inc') \
15011501
ON CONFLICT DO NOTHING",
15021502
);
15031503
match stmt {
@@ -1516,7 +1516,7 @@ fn parse_pg_on_conflict() {
15161516

15171517
let stmt = pg_and_generic().verified_stmt(
15181518
"INSERT INTO distributors (did, dname, dsize) \
1519-
VALUES (5, 'Gizmo Transglobal', 1000), (6, 'Associated Computing, Inc', 1010) \
1519+
VALUES (5, 'Gizmo Transglobal', 1000), (6, 'Associated Computing, Inc', 1010) \
15201520
ON CONFLICT(did) \
15211521
DO UPDATE SET dname = $1 WHERE dsize > $2",
15221522
);
@@ -1553,7 +1553,7 @@ fn parse_pg_on_conflict() {
15531553

15541554
let stmt = pg_and_generic().verified_stmt(
15551555
"INSERT INTO distributors (did, dname, dsize) \
1556-
VALUES (5, 'Gizmo Transglobal', 1000), (6, 'Associated Computing, Inc', 1010) \
1556+
VALUES (5, 'Gizmo Transglobal', 1000), (6, 'Associated Computing, Inc', 1010) \
15571557
ON CONFLICT ON CONSTRAINT distributors_did_pkey \
15581558
DO UPDATE SET dname = $1 WHERE dsize > $2",
15591559
);

0 commit comments

Comments
 (0)