jdbc PSQLException:错误:“ CONFLICT”或附近的语法错误

时间:2018-11-22 14:24:28

标签: java sql postgresql jdbc

我正在尝试使用JDBC更新我的postgres数据库中的表,并且对于我的大多数查询来说,它都可以正常工作。但是有时我会收到此错误:

val arrayPersons = persons.toArray
val index = arrayPersons.indexOf(Person("Tom"))

if (index >= 0)
   result = (arrayPersons.lift(index-1), arrayPersons.lift(index+1))

当我在postgres中手动执行请求时,它可以正常工作:

result = persons.sliding(3).foldLeft((Option.empty[Person], Option.empty[Person]))
{
    case ((Some(prev), Some(next)), _)            => (Some(prev), Some(next))
    case (_, prev :: Person(`name`) :: next :: _) => (Some(prev), Some(next))
    case (_, _ :: prev :: Person(`name`) :: _)    => (Some(prev), None)
    case (_, Person(`name`) :: next :: _)         => (None, Some(next))
    case (neighbours, _) => neighbours
}

有人知道发生了什么吗? 编辑:这是我连接到数据库并发送查询的方式:

org.postgresql.util.PSQLException: ERROR: syntax error at or near "CONFLICT"

我无法显示如何创建查询,但只有用户与pb一起使用,请求的格式都与上面的相同

0 个答案:

没有答案
相关问题