ERROR: 重复的键值违反了唯一约束 “constraint_name”

huangapple go评论94阅读模式
英文:

ERROR: duplicate key value violates unique constraint "constraint_name"

问题

我一直在收到以下错误:

错误:重复的关键值违反唯一约束“child_pkey”
详细信息:关键字(child_id)=(4)已存在。

这是我尝试运行的查询:

INSERT INTO child
VALUES(4, 'Max','Roy','M', 2) ;

对于child_id=4,我现在还没有插入任何数据,但我仍然收到此错误。
为了交叉检查,我检查了表,没有现有的child_id = 4的条目。
如果有人能帮忙,我将不胜感激。

英文:

I have been recieving the following error:

ERROR: duplicate key value violates unique constraint "child_pkey"
DETAIL: Key (child_id)=(4) already exists.

This is the query I tried to run:

INSERT INTO child
VALUES(4, 'Max','Roy','M', 2) ;

for child_id=4 i have not inserted any data as for now but I am still recieving this error.
Just to cross check I did check the table, and there was no existing entries for child_id = 4
I will be grateful if anyone could help.

答案1

得分: 2

尝试截断该条目,如果ik一直执行相同操作,启动表查询,删除所有表格然后重新创建。

英文:

Try to truncate that entry, if ik keeps doing the same, launch the table query, drop all the table and create it again.

huangapple
  • 本文由 发表于 2023年7月20日 13:37:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76726948.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定