Auto Increment on users table is not functioning I need to Create a new user programmatically. So, I have used user_save method, as shown here:

$usersave = array(
'name' =&gt; 'abc',
'pass' =&gt; 'abc',
'mail' =&gt; 'abc@gmail.com',
'status' =&gt; 1,
'roles' =&gt; array(
  DRUPAL_AUTHENTICATED_RID =&gt; 'authenticated user',
      5 =&gt; 'customer'
),
);

$save = user_save($usersave);


But it throws this error message:


  PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY': INSERT INTO {users} (name, pass, mail, status) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => abc [:db_insert_placeholder_1] => abc [:db_insert_placeholder_2] => abc@gmail.com [:db_insert_placeholder_3] => 1 ) in drupal_write_record() (line 7383 of /home/vijay/public_html/vssb/public/includes/common.inc).


What's the issue?
This is a duplicate of Create a user programmatically and give they a role

// The first parameter should be blank so a new user is created.
user_save('', $new_user);


If you want to use user_save($new_user); you can set $new_user-&gt;is_new to TRUE or omit the $account->uid field.