Postgres, duplicate unique index

[亡魂溺海] 提交于 2019-12-11 08:15:25

问题


I have a unique index column named "hash"

However when I run query:

 SELECT *
 FROM urls_0
 WHERE hash = '\x0009cb31d8a6c0c64f6877c22a781804'::bytea

There are two rows and I can not reindex that index because of unique violation. What happen here. I'm using PostgreSQL 9.3.2


回答1:


It could happen if you use CREATE INDEX CONCURRENTLY clause.

from documentation:

If a problem arises while scanning the table, such as a uniqueness violation in a unique index, the CREATE INDEX command will fail but leave behind an "invalid" index. This index will be ignored for querying purposes because it might be incomplete; however it will still consume update overhead.



来源:https://stackoverflow.com/questions/21811753/postgres-duplicate-unique-index

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!