Port changes of generalization of old mysql-specific autoincrement support.