【发布时间】:2021-03-08 05:14:33
【问题描述】:
我有这个错误:
SQL 错误 [23505]:错误:重复键值违反唯一约束“name_pkey” 详情:Key (status_id, type)=(0, 1) 已经存在。
当我执行这个更新脚本时:
update schema.table_name
set type = '1'
where status_id in ('AT', '0', '1',);
【问题讨论】:
-
表中已经有一行状态为0,类型为1,并且你有一个禁止重复的唯一键。你想怎么处理?
标签: sql postgresql