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?
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
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?