Can't upgrade plugins post upgrade
Asked by Yan Kravchenko:

Can't upgrade plugins, getting errors in the log that start with:

org.postgresql.util.PSQLException: ERROR: relation "AO_6384AB_FEATURE_METADATA_AO_ID_seq" does not exist

Everything else seems to work OK...


Answers:
author: Shannon S
body: Yan,

Can you tell us your current Confluence version, and the version you upgraded from? Please also confirm your PostgreSQL version.

Lastly, let us know exactly which steps you took to perform the upgrade.

Regards,

Shannon

comments: author: Yan Kravchenko
body: I am running version 6.8.2, upgraded from a very recent version... 6.8.0 I think.

--------------------------  
Database Information  
--------------------------  
Database Dialect: com.atlassian.confluence.impl.hibernate.dialect.PostgreSQLDialect  
Database URL: jdbc:postgresql://localhost:5432/confluencedb  
Database Driver Name: org.postgresql.Driver  
Database Driver Version: 42.1.1  
Database Name: PostgreSQL  
Database Version: 9.6.6  
Database Latency (ms): 0

For the upgrade, I executed the .bin file and followed all the prompts.

Thanks,

Yan


author: Shannon S
body: Thank you, Yan.

So, it does seem there's an issue with the current database, so let's try this.

1. Install a fresh copy of your previous Confluence version (in this case, 6.8.0) against a new database.
2. Import your XML backup into this.
3. Now perform the same upgrade you tried before.
4. Lastly, re-install any user-installed add-ons. Therefore, you will want to make a note of the add-ons you've installed on your current instance.

Let me know how it goes and if you have any questions.

Shannon


author: Yan Kravchenko
body: Hi Shannon,

Unfortunately, this will not work. I don't have the 6.8.0 installation files and perhaps too rashly deleted the backup I took before the upgrade.

Additional information:

The add-ons are actually up-to-date. I uninstalled them (no error) and re-installed them (same error). Yet, they all seem to work correctly.

Thank you,

Yan


author: Shannon S
body: Yan,

In that case, you will need to directly modify the database, which is not recommended.

Before you proceed, **please create a backup of your instance.**

1. Backup Confluence and stop it.
2. In your database, perform the following query to create a sequence:

   ```
   CREATE  SEQUENCE  "AO_6384AB_FEATURE_METADATA_AO_ID_seq"  INCREMENT  BY  1      MINVALUE 1  MAXVALUE 9223372036854775807       START  WITH 1   NO  CYCLE      OWNED BY  "AO_6384AB_FEATURE_METADATA_AO"."ID"
   ```

3. Next, find the current max ID in the table:

   ```
   SELECT max("ID") from "AO_6384AB_FEATURE_METADATA_AO"
   ```

4. You take this number, add 1, and use that in the query to set the next value:

   ```
     SELECT setval('"AO_6384AB_FEATURE_METADATA_AO_ID_seq"', +1 , true)
   ```

5. Once completed, start Confluence again.

This should fix the missing sequence.

If you happen to get an error that mentions **relation exist** then it is likely a permissions issue.

Let me know if you have any questions.

Regards,

Shannon


author: Yan Kravchenko
body: That worked, thank you!


author: Shannon S
body: Yan,

Great news! Thank you for confirming.

Take care and have a pleasant rest of your week!

Shannon


Tags: confluence-server

server