- Set up a Confluence 5.1.x instance
- Change some usernames in one of the tables to have trailing spaces. Example:
- Upgrade to Confluence 5.2.5
Upgrade should proceed smoothly without any issues
After Confluence retrieve all usernames:
It is trying to insert all the users into user_mapping table:
and then it tries to insert the same username (with trailing space) to user_mapping table
However, this fails:
Replicated by upgrading to 5.2.3 as well.
MySQL and SQL Server (possibly others) database servers ignore trailing space when comparing strings. On instances where a user with a certain username and another user with the same username with whitespace characters in the end (e.g. 'jdoe' and 'jdoe ') have existed, the upgrade is likely to fail
- Rollback your Confluence database to pre-upgrade state and ensure that the user_mapping table does not exist. If it does, run this query to drop it:
- Run the following SQL queries to find out which tables are affected:
- Run the following SQL queries to fix affected tables:
- Restart Confluence. Upgrade should pick up where it failed and it should complete successfully.