Confluence Space import fails due to 'duplicate key value violates unique constraint' error


アトラシアン コミュニティをご利用ください。



When importing a Space into Confluence, the import fails due to a duplicate key error.

atlassian-confluence.log ファイルに次の情報が表示されます。

Import failed. Check your server logs for more information. com.atlassian.confluence.importexport.ImportExportException: Unable to complete import because the data does not match the constraints in the Confluence schema. Cause: PSQLException: ERROR: duplicate key value violates unique constraint "bandana_unique_key"


This behavior is caused by entries already existing within the Confluence database that would be duplicated by the import. 

The Confluence 'bandana' table has the following unique key constraint:

"bandana_unique_key" UNIQUE CONSTRAINT, btree (bandanacontext, bandanakey)

There are multiple possible causes for this constraint to be violated.


  1. Follow the instructions to enable Enabling Detailed SQL Logging
  2. Attempt the Space import
  3. Confluence を停止します。
  4. Find the INSERT query that is causing the unique constraint violation
    • Note the banadanacontext and bandanakey values being set
  5. Delete whatever entry already exists:

    delete from BANDANA
    where BANDANACONTEXT = '<BANDANACONTEXT-value-from-insert-query>' and BANDANAKEY = '<BANDANAKEY-value-from-insert-query>';

  6. Confluence を起動します。
  7. Attempt the Space import (repeat as needed)


最終更新日 2017 年 8 月 28 日


Powered by Confluence and Scroll Viewport.