0

I got aware that the column name in TABLE users has a UNIQUE Constraint, when I tried to register a 2nd user with the same username : it returned a `integrity constraint violation 1062 duplicate entry '' for key 'name'.

Lets' say 2 of my customers called "John Doe" want to create an account : Ths 2nd one could not then ?!

So I made a quick SQL fix

ALTER TABLE `users` DROP INDEX `name`

I'd like to be sure it's not a very bad idea for some reasons ?

Config : this is a Drupal Commons distro

  • The name field is the username of your user and should be unique, just like the mail field. – Scott Joudry Jul 28 '14 at 16:49
  • @ScottJoudry, thanks for your reply. I realise, maybe tired, I made a stupid confusion btw real name & login. I may vote for deleting that question and try to solve that bug then – Kojo Jul 28 '14 at 17:15
3

It's a bad idea, your are modifying a core feature of Drupal that others module (and the core itself) may relay on. That's the reason why that column has 'UNIQUE' option, because Drupal requires unique username. Think on user login: how you can login with different users if the have the same username?

Check this answer where you may find more info: Is it possible to allow duplicate usernames ?

  • Thanks for your reply. Well people actually log in with email, cause I already use Email registration (don't remember but I think it came with Commons). I realise, maybe tired, I made a stupid confusion btw real name & login. I may vote for deleting my question :) – Kojo Jul 28 '14 at 17:13
  • Check the answer I link, some answers talk about login with email. – sanzante Jul 28 '14 at 17:14
  • Yes, realname is absolutely different from username, in fact you can make username not visible for users and be only used by Drupal internals. – sanzante Jul 28 '14 at 17:15
  • of course, tks, I had a moment of confusion :( – Kojo Jul 28 '14 at 17:16
  • 1
    All have moments of confusion :). I think you can leave the question because can be an advice for others that may want to make thatn change or wonder why username is unique, but it's up to you. – sanzante Jul 28 '14 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.