← Back to team overview

enterprise-support team mailing list archive

[Bug 1306391] Re: ALTER TABLE doesn't throw error while setting auto_increment value to the column

 

This is easy to confirm:

[openxs@chief p5.6]$ bin/mysql --no-defaults -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.16-64.2 MySQL Community Server (GPL)

Copyright (c) 2009-2014 Percona LLC and/or its affiliates
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input
statement.

mysql> CREATE TABLE `inc_test` (
    ->   `id` bigint(11) NOT NULL DEFAULT '0',
    ->   `animal` varchar(10) DEFAULT NULL,
    ->   PRIMARY KEY (`id`)
    -> ) ENGINE=InnoDB ;
Query OK, 0 rows affected (0.43 sec)

mysql> alter table inc_test auto_increment=7;
Query OK, 0 rows affected (0.04 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> show create table inc_test\G
*************************** 1. row ***************************
       Table: inc_test
Create Table: CREATE TABLE `inc_test` (
  `id` bigint(11) NOT NULL DEFAULT '0',
  `animal` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

Manual does not explain that option may be silently ignored when does
not apply:

" To change the value of the AUTO_INCREMENT counter to be used for new
rows, do this:

ALTER TABLE t2 AUTO_INCREMENT = value;

You cannot reset the counter to a value less than or equal to to the
value that is currently in use. For both InnoDB and MyISAM, if the value
is less than or equal to the maximum value currently in the
AUTO_INCREMENT column, the value is reset to the current maximum
AUTO_INCREMENT column value plus one. "

** Also affects: percona-server/5.1
   Importance: Undecided
       Status: New

** Also affects: percona-server/5.6
   Importance: Undecided
       Status: New

** Also affects: percona-server/5.5
   Importance: Undecided
       Status: New

** Tags added: upstream

** Changed in: percona-server/5.6
       Status: New => Confirmed

** Changed in: percona-server/5.5
       Status: New => Confirmed

** Bug watch added: MySQL Bug System #72315
   http://bugs.mysql.com/bug.php?id=72315

** Also affects: mysql-server via
   http://bugs.mysql.com/bug.php?id=72315
   Importance: Unknown
       Status: Unknown

** Changed in: percona-server/5.1
       Status: New => Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Server/Client Support Team, which is subscribed to MySQL.
Matching subscriptions: Ubuntu Server/Client Support Team
https://bugs.launchpad.net/bugs/1306391

Title:
  ALTER TABLE doesn't throw error while setting auto_increment value to
  the column

To manage notifications about this bug go to:
https://bugs.launchpad.net/mysql-server/+bug/1306391/+subscriptions