# Upgrade probleem met dubbele gebruikersnaam in DB

**URL:** <https://meta.discourse.org/t/upgrade-issue-with-duplicate-username-in-db/177664>\
**Category:** Self-hosting\
**Created:** [29 januari 2021 om 12:30 UTC](https://meta.discourse.org/t/upgrade-issue-with-duplicate-username-in-db/177664 "2021-01-29T12:30:19Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![volksman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/volksman/32/207678_2.png) [@volksman](https://meta.discourse.org/u/volksman)\
**Post date:** [29 januari 2021 om 12:30 UTC](https://meta.discourse.org/t/upgrade-issue-with-duplicate-username-in-db/177664/1 "2021-01-29T12:30:19Z")

</div>

So I tried to upgrade my board this morning and got an error:

> PG::UniqueViolation: ERROR: duplicate key value violates unique constraint “index\_users\_on\_username”

It names a user “MikeC”. So I did some digging and it advised that I should restore postgres\_data and start my board again, then look at the DB for duplicates. So I ran a quick query for username\_lower = ‘mikec’ and found 1 row. Then I found this fancy query:

`SELECT username_lower, count(*) from users GROUP by username_lower HAVING count(*) > 1;`

Which returned no rows. So where is the duplicate? Any help appreciated. I am running on the old data but I would like to be able to rebuild the app properly.

---

_[View the full topic](https://meta.discourse.org/t/upgrade-issue-with-duplicate-username-in-db/177664)._
