Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.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数据库表中存在重复的唯一约束_Postgresql - Fatal编程技术网

PostgreSQL数据库表中存在重复的唯一约束

PostgreSQL数据库表中存在重复的唯一约束,postgresql,Postgresql,我无意中(在数据库迁移期间)在列上创建了一个唯一约束,该约束已经定义了相同的唯一约束。基本上我是这样结束的: => select * from information_schema.table_constraints where table_name = 'users' and constraint_type = 'UNIQUE'; constraint_catalog | constraint_schema | constraint_name | table_catalog | ta

我无意中(在数据库迁移期间)在列上创建了一个唯一约束,该约束已经定义了相同的唯一约束。基本上我是这样结束的:

=> select * from information_schema.table_constraints where table_name = 'users' and constraint_type = 'UNIQUE';
 constraint_catalog | constraint_schema | constraint_name  | table_catalog | table_schema | table_name | constraint_type | is_deferrable | initially_deferred
--------------------+-------------------+------------------+---------------+--------------+------------+-----------------+---------------+--------------------
 fo-auth            | public            | users_email_key  | fo-auth       | public       | users      | UNIQUE          | NO            | NO
 fo-auth            | public            | users_email_key1 | fo-auth       | public       | users      | UNIQUE          | NO            | NO
(2 rows)

这是一个值得担心的问题,还是我可以接受它?

只要去掉多余的约束:

alter table users drop constraint users_email_key1;
两个相同的约束不会造成任何伤害,但会不必要地延长插入和更新的时间