Upgrade Issues: Failed Upgrade due to Duplicate Key, Failed Snapshot Restore

I had what u think was a similar case yesterday (see Help! Upgrade led to complete fail - #8 by Judith). In broad strokes, I think you need to do something like

  • rename the postgres_data _old back to postgres_data
  • restart he old container
  • fix the corrupt index problem by renaming the duplicate users (or perhaps users that are duplicate because they have different capitalization
  • build the indexes on the user table to make sure they are all fixed
  • change to the postgres 12 template as described in PostgreSQL 13 update
  • rebuild to upgrade
  • when that works, you can change the template back and finish the upgrade.
  • note that you need to update not only the username but also the username_lower

The one that I fixed yesterday had a duplicate username as old as February 2020, so you likely don’t want to try to fix this by restoring an older database.

To fix it you need to understand how to modify records with the postgres command line , rebuild databases, and deal with complex, but well documented, issues in the postgres 13 upgrade.

If you have a $500 budget you can contact me. My contact info is in my profile.