-
Bug
-
Resolution: Fixed
-
Medium
-
5.4.1, 5.4.3, 5.4.4, 5.7.1, 1000.71.0
-
30
-
Severity 2 - Major
-
4
-
NOTE: This bug report is for Confluence Server. Using Confluence Cloud? See the corresponding bug report.
Steps to Reproduce:
- Setup Confluence with Microsoft SQL Server, PostGreSQL or MySQL
- Create a space
- Create a page
- Add restriction into the page you just created
- Export this space
- Import the exported space into Confluence instance that use Microsoft SQL Server as its database
Expected Results:
Confluence should be able to import this space as it could with Confluence that use PostGreSQL or MySQL database.
Actual Results:
Confluence with MS SQL server will failed to process the space import with the following stack traces:
Caused by: org.xml.sax.SAXException: Error while importing backup: Hibernate operation: could not insert: [com.atlassian.confluence.security.ContentPermission#8323117]; SQL []; Violation of UNIQUE KEY constraint 'cp_unique_user_groups'. Cannot insert duplicate key in object 'dbo.CONTENT_PERM'. The duplicate key value is (8257543, View, <NULL>, <NULL>).; nested exception is java.sql.SQLException: Violation of UNIQUE KEY constraint 'cp_unique_user_groups'. Cannot insert duplicate key in object 'dbo.CONTENT_PERM'. The duplicate key value is (8257543, View, <NULL>, <NULL>). org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not insert: [com.atlassian.confluence.security.ContentPermission#8323117]; SQL []; Violation of UNIQUE KEY constraint 'cp_unique_user_groups'. Cannot insert duplicate key in object 'dbo.CONTENT_PERM'. The duplicate key value is (8257543, View, <NULL>, <NULL>).; nested exception is java.sql.SQLException: Violation of UNIQUE KEY constraint 'cp_unique_user_groups'. Cannot insert duplicate key in object 'dbo.CONTENT_PERM'. The duplicate key value is (8257543, View, <NULL>, <NULL>). at com.atlassian.confluence.importexport.xmlimport.parser.BackupParser.endElement(BackupParser.java:53)
Workaround 1
Remove all page restrictions from the source Confluence before generating the space export. Then re-add the restrictions in the target instance after the import
Workaround 2
- Drop the constraint in the target instance:
ALTER TABLE CONTENT_PERM DROP CONSTRAINT cp_unique_user_groups;
- Restore the Space
- Re-add the constraint:
ALTER TABLE CONTENT_PERM ADD CONSTRAINT [cp_unique_user_groups] UNIQUE NONCLUSTERED ( [CPS_ID] ASC, [CP_TYPE] ASC, [USERNAME] ASC, [GROUPNAME] ASC );
Workaround 3
Migrate your Confluence database server to other supported database.
- is duplicated by
-
CONFCLOUD-53554 Space import will fail if there are restrictions set on page with both confluence-administrators and administrators groups
- Closed
- relates to
-
CONFCLOUD-33777 Space Export Containing Page Restriction Fails during import into Confluence with SQL Server
- Closed
-
CONFSERVER-41732 XML import can cause duplicate key errors
- Closed
-
CONFSERVER-35983 XML space import failed caused by ConstraintViolationException when using Oracle
- Gathering Impact