Score:0

Auto increment value less than max uid on users table

in flag

I'm seeing these errors flooding my log file.

They come from commerce order complete pages - and some registration pages too.

Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '813' for key 'users.PRIMARY': INSERT INTO "users" ("uuid", "langcode") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => 62100ab3-1cba-49e4-98ea-af0f74d6dc09 [:db_insert_placeholder_1] => en ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 815 of /etc/apache2/htdocs/drupal-8/neway-drupal-project/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

With a little further digging - I can see that the Auto_increment on the Users table is out of synch with the max value of uid.

Running:

SHOW TABLE STATUS WHERE `Name` = 'users';

Gives:

814 in the Auto_incerment column

Running:

select max(uid) from users;

Gives:

1392

So this explains the reason.

So the question is - how can I safely reset the auto_increment value without breaking any other Drupal dependencies?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.