Bug #65895 Assertion incorrect in manual
Submitted: 13 Jul 2012 18:15 Modified: 1 Feb 2013 19:17
Reporter: Trey Raymond Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: John Russell CPU Architecture:Any
Tags: Docs, innodb, primary key, replication

[13 Jul 2012 18:15] Trey Raymond
Description:
http://dev.mysql.com/doc/refman/5.5/en/replication-features-auto-increment.html
(this is also in the 5.5.25 changelog)

The incorrect quote:
"This issue does not affect tables using the InnoDB storage engine, since InnoDB does not allow the creation of a composite key that includes an AUTO_INCREMENT column that is not the first column in the key."

InnoDB does allow the creation of such keys, as seen in this valid table:

CREATE TABLE `test` (
  `a` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `b` int(10) unsigned NOT NULL,
  `c` int(10) unsigned NOT NULL,
  PRIMARY KEY (`b`,`a`),
  KEY `c` (`c`,`a`),
  KEY `a` (`a`,`b`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

The limitation is that at least one key must exist where the auto increment is the only or leftmost column.  That's the only restriction innodb puts on them.  This document will lead users to believe innodb is not capable of something that is standard practice in database design.

How to repeat:
n/a

Suggested fix:
change it to something like I said, "at least one key must exist where the auto increment is the only or leftmost column"
[13 Jul 2012 18:15] Trey Raymond
changelog page where it is also incorrect:
http://dev.mysql.com/doc/refman/5.5/en/news-5-5-25.html
[13 Jul 2012 19:41] Valeriy Kravchuk
Thank you for the bug report.
[1 Feb 2013 19:17] John Russell
Clarified as suggested, in 5.1-5.6 manuals and the 5.5 changelog.