Permalink
Browse files

fix transaction for postgresql upsert

  • Loading branch information...
1 parent 3b3bd36 commit 9fe322693b89bb3c82728b1d0d5a39c032183f22 @AtkinsChang AtkinsChang committed Oct 15, 2015
Showing with 1 addition and 1 deletion.
  1. +1 −1 slick/src/main/scala/slick/jdbc/PostgresProfile.scala
@@ -173,7 +173,7 @@ trait PostgresProfile extends JdbcProfile {
val nonAutoIncVars = nonAutoIncSyms.map(_ => "?").mkString(",")
val cond = pkNames.map(n => s"$n=?").mkString(" and ")
val insert = s"insert into $tableName ($nonAutoIncNames) select $nonAutoIncVars where not exists (select 1 from $tableName where $cond)"
- new InsertBuilderResult(table, s"begin; $update; $insert; end", ConstArray.from(softSyms ++ pkSyms))
+ new InsertBuilderResult(table, s"$update; $insert", ConstArray.from(softSyms ++ pkSyms))
}
override def transformMapping(n: Node) = reorderColumns(n, softSyms ++ pkSyms ++ nonAutoIncSyms.toSeq ++ pkSyms)

0 comments on commit 9fe3226

Please sign in to comment.