Bug #79484 doc bug in AUTO_INCREMENT, after manually inserting value
Submitted: 1 Dec 2015 21:36 Modified: 3 Dec 2015 14:04
Reporter: Rick James Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:Any OS:Any
Assigned to: CPU Architecture:Any
Tags: auto_increment

[1 Dec 2015 21:36] Rick James
Description:
https://dev.mysql.com/doc/refman/5.6/en/example-auto-increment.html
says
"the column is set to that value and the sequence is reset so that the next automatically generated value follows sequentially from the inserted value"

It should say

"the column is set to that value and the sequence is reset so that the next automatically generated value follows sequentially from the **largest** value"

See http://stackoverflow.com/questions/33609111/mysql-reserving-ids-before-the-initial-auto-in...

How to repeat:
CREATE TABLE `users` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
ALTER TABLE users AUTO_INCREMENT = 1000;

INSERT INTO `users` (`id`, `username`) VALUES (1, 'something');
INSERT INTO `users` (`id`, `username`) VALUES (999, 'something');
INSERT INTO `users`(`username`) VALUES ('new value');  -- 1000
INSERT INTO `users` (`id`, `username`) VALUES (111, 'something'); -- 111

INSERT INTO `users`(`username`) VALUES ('112? or 1001?'); -- will be 1001

Suggested fix:
Reword documentation as indicated.
[2 Dec 2015 6:14] MySQL Verification Team
Hello Rick,

Thank you for the report.

Thanks,
Umesh
[3 Dec 2015 14:04] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly.