Commit 7a8357e8 authored by unknown's avatar unknown
Browse files

Initial value for a auto_increment can now be set using ALTER TABLE

AUTO_INCREMENT = X; or CREATE TABLE .. AUTO_INCREMENT = X; This
change is backported from 5.0 (Bug #7061).


sql/ha_innodb.cc:
  Initial value for a auto_increment can now be set using ALTER TABLE
  AUTO_INCREMENT = X; or CREATE TABLE .. AUTO_INCREMENT = X; This
  change is backported from 5.0.
parent 1a8d41a5
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -3939,6 +3939,20 @@ ha_innobase::create(

	DBUG_ASSERT(innobase_table != 0);

	if ((create_info->used_fields & HA_CREATE_USED_AUTO) &&
	   (create_info->auto_increment_value != 0)) {

		/* Query was ALTER TABLE...AUTO_INCREMENT = x; or 
		CREATE TABLE ...AUTO_INCREMENT = x; Find out a table
		definition from the dictionary and get the current value
		of the auto increment field. Set a new value to the
		auto increment field if the value is greater than the
		maximum value in the column. */

		auto_inc_value = create_info->auto_increment_value;
		dict_table_autoinc_initialize(innobase_table, auto_inc_value);
	}

	/* Tell the InnoDB server that there might be work for
	utility threads: */

@@ -5346,8 +5360,9 @@ ha_innobase::store_lock(
			/* In case we have innobase_locks_unsafe_for_binlog
			option set and isolation level of the transaction
			is not set to serializable and MySQL is doing
			INSERT INTO...SELECT without FOR UPDATE or IN
			SHARE MODE we use consistent read for select. */
			INSERT INTO...SELECT or UPDATE ... = (SELECT ...)
			without FOR UPDATE or IN SHARE MODE in select, then
			we use consistent read for select. */

			prebuilt->select_lock_type = LOCK_NONE;
			prebuilt->stored_select_lock_type = LOCK_NONE;