如果在插入或批量插入时出现冲突可以使用on conflict (field)关键字处理冲突,括号内为冲突字段
1.忽略冲突数据,继续执行。

  在语句末尾加上on conflict (id) do nothing

2.冲突数据,执行更新。
  在语句末尾加上 on conflict (id) do 
            update set  
             username = excluded.username

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2021-12-20
  • 2021-08-30
  • 2023-03-06
  • 2021-06-01
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案