From 3708430ebfb878ef8fb8886c05a19296ac5f2365 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Mon, 13 Mar 2023 10:44:56 +0000 Subject: [PATCH] slight adjustment Signed-off-by: Andrew Thornton --- internal/statements/upsert.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/statements/upsert.go b/internal/statements/upsert.go index 637a10b2..725daba0 100644 --- a/internal/statements/upsert.go +++ b/internal/statements/upsert.go @@ -157,9 +157,9 @@ func (statement *Statement) genMergeSQL(doUpdate bool, columns []string, args [] } countUniques++ write("(") - write("src.", quote(index.Cols[0]), "= target.", quote(index.Cols[0])) + write("src.", quote(index.Cols[0]), " = target.", quote(index.Cols[0])) for _, col := range index.Cols[1:] { - write(" AND src.", quote(col), "= target.", quote(col)) + write(" AND src.", quote(col), " = target.", quote(col)) } write(")") } @@ -175,7 +175,7 @@ func (statement *Statement) genMergeSQL(doUpdate bool, columns []string, args [] } write(" WHEN NOT MATCHED THEN INSERT ") includeAutoIncrement := statement.includeAutoIncrement(columns) - if len(columns) == 0 { + if len(columns) == 0 && statement.dialect.URI().DBType == schemas.MSSQL { write(" DEFAULT VALUES ") } else { // We have some values - Write the column names we need to insert: