user1382306
user1382306

Reputation:

Does auto increment start again at 0 if max value reached?

Does MySQL's auto increment reset to 0 after reaching the maximum value?

In other words, if an UNSIGNED SMALLINT column with AUTO_INCREMENT reaches 65535 what happens on a new INSERT?

If there are no available values, what happens then?

Upvotes: 3

Views: 1721

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269623

The documentation is pretty clear on what happens:

When the column reaches the upper limit of the data type, the next attempt to generate a sequence number fails.

Read about it here.

So the answer to your question is "no". It generates an error.

Upvotes: 4

Related Questions