# Are usernames not unique anymore (3.5.0)?

**URL:** <https://forum.heroiclabs.com/t/are-usernames-not-unique-anymore-3-5-0/1954>\
**Category:** Runtime Framework\
**Tags:** server-framework\
**Created:** [September 17, 2021, 1:08pm UTC](https://forum.heroiclabs.com/t/are-usernames-not-unique-anymore-3-5-0/1954 "2021-09-17T13:08:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![NixarnTowerPop](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/nixarntowerpop/32/800_2.png) [@NixarnTowerPop](https://forum.heroiclabs.com/u/NixarnTowerPop)\
**Post date:** [September 17, 2021, 1:08pm UTC](https://forum.heroiclabs.com/t/are-usernames-not-unique-anymore-3-5-0/1954/1 "2021-09-17T13:08:59Z")

</div>

Previously usernames had to be unique, which makes sense. But I noticed now when I’m calling UpdateAccountAsync, that I could use any username and on the admin I it showed multiple users with the same usernames.

Is this by design or are there some bug in the latest nakama version? We updated from 3.1.2 to 3.5.0.

Thanks!

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [September 18, 2021, 7:12pm UTC](https://forum.heroiclabs.com/t/are-usernames-not-unique-anymore-3-5-0/1954/2 "2021-09-18T19:12:17Z")

</div>

@NixarnTowerPop Usernames are required to be unique and always will be. That hasn’t changed. You can see in the database schema that we require a unique index on the username column of the users table:

> <https://github.com/heroiclabs/nakama/blob/master/migrate/sql/20180103142001_initial_schema.sql#L22>

The display\_name field of the user is not unique and is allowed to be the same across users in the game. Are you certain that you see users in the system with the same username? Can you run this query to check whether a username you see more than once is actually in-use by more than one user?

```sql
SELECT count(id) FROM users WHERE username = 'duplicate-username';

```

---

<div class="post-metadata">

**Author:** ![NixarnTowerPop](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/nixarntowerpop/32/800_2.png) [@NixarnTowerPop](https://forum.heroiclabs.com/u/NixarnTowerPop)\
**Post date:** [September 20, 2021, 6:28am UTC](https://forum.heroiclabs.com/t/are-usernames-not-unique-anymore-3-5-0/1954/3 "2021-09-20T06:28:41Z")

</div>

Thanks! Yeah that makes sense, but at the moment, looking at our admin, we’re able to have two identical usernames. I wanted the client to complain that the username was already taken, but wouldn’t get an exception, that’s when I looked into it. I’ll investigate on our side, I wonder if our test server has had that user table altered.

Edit: So apparently our lead dev wiped the database when updating to 3.5.X, but somehow old users still show on the console, so I wonder if it’s just some caching issue.

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [September 20, 2021, 1:31pm UTC](https://forum.heroiclabs.com/t/are-usernames-not-unique-anymore-3-5-0/1954/4 "2021-09-20T13:31:35Z")

</div>

@NixarnTowerPop Thanks for the update. Want to open an issue about the view state in the Nakama Console to indicate that it may be cached incorrectly?

---

<div class="post-metadata">

**Author:** ![NixarnTowerPop](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/nixarntowerpop/32/800_2.png) [@NixarnTowerPop](https://forum.heroiclabs.com/u/NixarnTowerPop)\
**Post date:** [September 22, 2021, 10:44am UTC](https://forum.heroiclabs.com/t/are-usernames-not-unique-anymore-3-5-0/1954/5 "2021-09-22T10:44:06Z")

</div>

I’ll do some more investigating to confirm my suspicion and if it looks as if I’m correct I’ll open an issue. Thanks!
