Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-13094

SHOW CREATE TABLE can report non-persistent AUTO_INCREMENT value before server restart

    XMLWordPrintable

    Details

      Description

      --source include/have_innodb.inc
       
      create table t1 (pk int auto_increment primary key, i int, unique (i)) engine=InnoDB;
      insert into t1 (i) values (1),(2),(3);
      insert ignore into t1 (pk, i) values (100,1);
      --echo #
      --echo # Table before restart
      show create table t1;
      --source include/restart_mysqld.inc
      --echo #
      --echo # Table after restart
      show create table t1;
       
      drop table t1;
      

      # Table before restart
      show create table t1;
      Table	Create Table
      t1	CREATE TABLE `t1` (
        `pk` int(11) NOT NULL AUTO_INCREMENT,
        `i` int(11) DEFAULT NULL,
        PRIMARY KEY (`pk`),
        UNIQUE KEY `i` (`i`)
      ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
      #
      # Table after restart
      show create table t1;
      Table	Create Table
      t1	CREATE TABLE `t1` (
        `pk` int(11) NOT NULL AUTO_INCREMENT,
        `i` int(11) DEFAULT NULL,
        PRIMARY KEY (`pk`),
        UNIQUE KEY `i` (`i`)
      ) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=latin1
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated: