Unable to upgrade Confluence with relation already existing in the database
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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
1
2
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:
Shutdown Confluence
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 making any database modifications. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
1
drop index c_si_ct_pv_cs_cd_idx;
Start Confluence
Attempt the upgrade again
Was this helpful?