Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql 尝试将约束添加到后执行upsert时发生PGSQL错误_Postgresql_Key_Constraints_Upsert - Fatal编程技术网

Postgresql 尝试将约束添加到后执行upsert时发生PGSQL错误

Postgresql 尝试将约束添加到后执行upsert时发生PGSQL错误,postgresql,key,constraints,upsert,Postgresql,Key,Constraints,Upsert,我不能在我的表上创建唯一的约束,也不明白为什么,因为我尝试使用upsert,它告诉我我不能这样做,因为我在表上没有约束。所以我试了一下: CREATE UNIQUE INDEX "unique_ID" ON "WU_MatchingUsers" ("IDWU_User1"); ERREUR: n'a pas pu créer l'index unique « unique_ID » DÉTAIL : La clé ("IDW

我不能在我的表上创建唯一的约束,也不明白为什么,因为我尝试使用upsert,它告诉我我不能这样做,因为我在表上没有约束。所以我试了一下:

CREATE UNIQUE INDEX "unique_ID" ON "WU_MatchingUsers" ("IDWU_User1");
ERREUR:  n'a pas pu créer l'index unique « unique_ID »
DÉTAIL : La clé ("IDWU_User1")=(1) est dupliquée.
我不明白为什么,也不知道该怎么办


亲切的问候

这意味着您已经有一些重复项(使用
DWU\u User1=1
),因此无法创建唯一索引。-->首先修复重复的值您所说的重复是什么意思?我检查了我的表,但在这一列中只有一个“1”::数据库显示不是这样,我相信它比我相信你的说法更重要。