Confluence 6 "Duplicate Key" 相关问题解决

如果你遇到了下面的错误信息,例如:

could not insert: [bucket.user.propertyset.BucketPropertySetItem#[email protected]]; SQL []; Violation of PRIMARY KEY constraint 'PK_OS_PROPERTYENTRY314D4EA8'. Cannot insert duplicate key in object 'OS_PROPERTYENTRY'.; nested exception is java.sql.SQLException: Violation of PRIMARY KEY constraint 'PKOS_PROPERTYENTRY_314D4EA8'. Cannot insert duplicate key in object 'OS_PROPERTYENTRY'.

这个错误信息说的是定义为’PK_OS_PROPERTYENTRY_314D4EA8’ 的主键在表 ‘OS_PROPERTYENTRY’ 中重复了。

你可以在 ‘OS_PROPERTYENTRY’ 表中找到 ‘PK_OS_PROPERTYENTRY_314D4EA8’ 中定义的主键,然后找到重复的值后删除重复的值。需要确定 “PRIMARY KEY” 必须保持不重复。一个可以找到 ‘OS_PROPERTYENTRY’ 表中是否有重复主键的 SQL 如下:

SELECT ENTITY_NAME,ENTITY_ID,ENTITY_KEY,COUNT(*) FROM OS_PROPERTYENTRY GROUP BY ENTITY_NAME,ENTITY_ID,ENTITY_KEY HAVING