Can't delete duplicates in user_mapping table with NULL lower_username

Maria Murphy August 8, 2022

While exporting a space and importing it into another instance, it is reporting an error that points to the duplicate entry for user name error as described in (https://confluence.atlassian.com/confkb/confluence-site-xml-import-fails-with-duplicate-key-error-438993638.html).

The above KB says to delete the entry with a NULL lower_username entry. However, when I try to do that, it fails because of a foreign key constraint:

mysql> delete from user_mapping where user_key='0c9f4cdb7f34bb56017f5329e889013b';
ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`confluence`.`CONTENT`, CONSTRAINT `FK_CONTENT_CREATOR` FOREIGN KEY (`CREATOR`) REFERENCES `user_mapping` (`user_key`))

How do I fix this? I looked at the CREATOR column of the CONTENT table, but values are all NULL.

I think the source of the problem is that we are migrating Spaces from a defunct  source environment and those migrations have users in the Spaces that don't have accounts in our  destination environment.  I suspect that those users are 'created' with the NULL lower_username.  Then when we create the actual user accounts, they have the same username, but because the accounts are created 'normally' they have the correct lower_username, hence the duplication? 

Now that those Spaces are in our environment, our exports of them fail to import elsewhere (e.g., a test instance).  Note that we do not want to export/import the entire Confluence, just specific spaces.

Any suggestions appreciated.

1 answer

0 votes
Brant Schroeder
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 8, 2022

@Maria Murphy I would suggest submitting a support issue to Atlassian https://support.atlassian.com/contact/ 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
7.13.7
TAGS
AUG Leaders

Atlassian Community Events