Deleted username but can not use that username in other user

I have deleted a user with username = “XXX” and I want yo change the username of other user with the same username of deleted user but I can not. I get the mensagges. “Username have to be unique”

How can I check if a username is taken or not complete deleted?

Regards

2 Likes

You can go in your admin -> users -> filter by username.
Alternatively, you could use data explorer.

1 Like

Yes, I have deleted the user from admin–>users but After that I can not use the same username that I removed

Then try using data-explorer and execute this request:

SELECT username FROM users WHERE username LIKE '%username%' 

Might give some clue.

1 Like

No results. But when I try to use the username of a user deleted I get the messages that username must be unique.

Other table where can be that username?

I don’t know. What is the username you’re trying to use?
Maybe you try a reserved username, but I guess you’d have a different message…
Also the previous user woudn’t have been able to choose it :man_shrugging:t6:

Here’s the code that checks if a username is already taken:

  USERNAME_EXISTS_SQL = <<~SQL
    (SELECT users.id AS id, true as is_user FROM users
    WHERE users.username_lower = :username)

    UNION ALL

    (SELECT groups.id, false as is_user FROM groups
    WHERE lower(groups.name) = :username)
  SQL

Any deleted user?

edit: I tried to rename a user the same name as a group, and it says the username must be unique. Maybe that’s your issue?

3 Likes

Do you have a group with this name? @Canapin is correct that users and groups share a namespace.

No, I have not any group with the same name.

Another thing is that I can mention in DM messages username of deleted users.