← Back to team overview

drizzle-discuss team mailing list archive

SHOW CREATE and AUTO_INCREMENT

 

We currently don't really show the AUTO_INCREMENT setting for SHOW
CREATE TABLE. This should probably be considered a bug.

e.g.
CREATE TABLE t1 (a int auto_increment) AUTO_INCREMENT=1000;
SHOW CREATE TABLE t1;

will not show AUTO_INCREMENT=1000;

The next question is should SHOW CREATE TABLE show the *current*
auto_increment value or the one the table was *created* with?

The mysql behaviour is the following:

CREATE TABLE `t1` (
t1_name VARCHAR(255) DEFAULT NULL,
t1_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
KEY (t1_name),
PRIMARY KEY (t1_id)
) AUTO_INCREMENT = 1000;
INSERT INTO t1 (t1_name) VALUES('MySQL');
INSERT INTO t1 (t1_name) VALUES('MySQL');
INSERT INTO t1 (t1_name) VALUES('MySQL');
SHOW CREATE TABLE `t1`;
Table   Create Table
t1      CREATE TABLE `t1` (
  `t1_name` varchar(255) DEFAULT NULL,
  `t1_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`t1_id`),
  KEY `t1_name` (`t1_name`)
) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1


Personally, I'm of the opinion that SHOW CREATE TABLE should show 1000
and not 1003 in this case.

thoughts?

-- 
Stewart Smith



Follow ups