Unable to upgrade Confluence with relation already existing in the database

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Problem

If you've already attempted an upgrade of Confluence, re-attempting the upgrade can cause the following error in the atlassian-confluence.log

2016-09-01 18:50:38,600 ERROR [localhost-startStop-1] [atlassian.confluence.plugin.PluginFrameworkContextListener] launchUpgrades Upgrade failed, application will not start: Upgrade task com.atlassian.confluence.upgrade.upgradetask.ContentIndexUpgradeTask@765a389f failed during the UPGRADE phase due to: StatementCallback; bad SQL grammar [create index c_si_ct_pv_cs_cd_idx on CONTENT (SPACEID, CONTENTTYPE, PREVVER, CONTENT_STATUS, CREATIONDATE)]; nested exception is org.postgresql.util.PSQLException: ERROR: relation "c_si_ct_pv_cs_cd_idx" already exists
com.atlassian.confluence.upgrade.UpgradeException: Upgrade task com.atlassian.confluence.upgrade.upgradetask.ContentIndexUpgradeTask@765a389f failed during the UPGRADE phase due to: StatementCallback; bad SQL grammar [create index c_si_ct_pv_cs_cd_idx on CONTENT (SPACEID, CONTENTTYPE, PREVVER, CONTENT_STATUS, CREATIONDATE)]; nested exception is org.postgresql.util.PSQLException: ERROR: relation "c_si_ct_pv_cs_cd_idx" already exists

Cause

Confluence is trying to create an index that should not yet exist, but is present from the previous upgrade attempt. The database was not rolledback completly.

Resolution

Remove the existing relation mentioned in the logs:

  1. Shutdown Confluence
  2. Remove the mentioned item from your database. In this case it was the c_si_ct_pv_cs_cd_idx index. Replace with the <generic-index-name> mentioned in your error:

    Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.

    drop index c_si_ct_pv_cs_cd_idx;
  3. Start Confluence

  4. Attempt the upgrade again

 

Last modified on Sep 10, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.