summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/r/innodb-alter-autoinc.result
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-08-29 11:27:28 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-08-29 15:28:58 +0300
commit8d9298167ec2251942953e6a1bdb4d4019b5957b (patch)
tree4e219a356762e0d346bd6b050a436bca34f4a55c /mysql-test/suite/innodb/r/innodb-alter-autoinc.result
parent888a8b69bd12ea979024448ba6893af770478bb2 (diff)
downloadmariadb-git-8d9298167ec2251942953e6a1bdb4d4019b5957b.tar.gz
MDEV-13625 Merge InnoDB test cases from MySQL 5.6 (part 1)
Import some ALTER TABLE test cases from MySQL 5.6 without modification. The adjustments will be in a separate commit.
Diffstat (limited to 'mysql-test/suite/innodb/r/innodb-alter-autoinc.result')
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter-autoinc.result174
1 files changed, 174 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/r/innodb-alter-autoinc.result b/mysql-test/suite/innodb/r/innodb-alter-autoinc.result
new file mode 100644
index 00000000000..8b4909917b3
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-alter-autoinc.result
@@ -0,0 +1,174 @@
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(347),(33101),(123),(45),(6);
+SET @old_sql_mode = @@sql_mode;
+SET @@sql_mode = 'STRICT_TRANS_TABLES';
+ALTER TABLE t1 ADD PRIMARY KEY(a);
+SET @@sql_mode = @old_sql_mode;
+ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
+LOCK=NONE;
+ERROR 0A000: LOCK=NONE is not supported. Reason: Adding an auto-increment column requires a lock. Try LOCK=SHARED.
+ALTER TABLE t1 ADD id INT AUTO_INCREMENT;
+ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
+ALTER TABLE t1 ADD id INT AUTO_INCREMENT, ADD INDEX(a, id);
+ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
+ALTER TABLE t1 ADD id INT NOT NULL, ADD INDEX(id, a);
+SELECT * FROM t1;
+a id
+6 0
+45 0
+123 0
+347 0
+33101 0
+SET AUTO_INCREMENT_INCREMENT = 5, AUTO_INCREMENT_OFFSET = 30;
+ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
+DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=COPY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL DEFAULT '0',
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`),
+ KEY `id` (`id`,`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1
+BEGIN;
+INSERT INTO t1 VALUES(7,0);
+SELECT * FROM t1;
+a id
+6 45
+45 50
+123 55
+347 60
+33101 65
+7 70
+ROLLBACK;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL DEFAULT '0',
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`),
+ KEY `id` (`id`,`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=latin1
+ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
+DROP COLUMN id, AUTO_INCREMENT = 42, LOCK=NONE;
+ERROR 0A000: LOCK=NONE is not supported. Reason: Adding an auto-increment column requires a lock. Try LOCK=SHARED.
+ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
+DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=INPLACE;
+SELECT * FROM t1;
+a id
+6 45
+45 50
+123 55
+347 60
+33101 65
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL DEFAULT '0',
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`),
+ KEY `id` (`id`,`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1
+INSERT INTO t1 SET a=123;
+INSERT INTO t1 VALUES(-123,-45);
+ALTER TABLE t1 AUTO_INCREMENT = 75;
+INSERT INTO t1 SET a=123;
+SELECT * FROM t1;
+a id
+-123 -45
+6 45
+45 50
+123 55
+347 60
+33101 65
+123 70
+123 75
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL DEFAULT '0',
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`),
+ KEY `id` (`id`,`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(347),(33101),(123),(45),(6);
+ALTER TABLE t1 ADD PRIMARY KEY(a);
+ALTER TABLE t1 ADD id INT NOT NULL, ADD INDEX(id, a);
+SELECT * FROM t1;
+a id
+6 0
+45 0
+123 0
+347 0
+33101 0
+ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
+DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=INPLACE;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL DEFAULT '0',
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`),
+ KEY `id` (`id`,`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1
+BEGIN;
+INSERT INTO t1 VALUES(7,0);
+SELECT * FROM t1;
+a id
+6 45
+45 50
+123 55
+347 60
+33101 65
+7 70
+ROLLBACK;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL DEFAULT '0',
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`),
+ KEY `id` (`id`,`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=latin1
+ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
+DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=COPY;
+SELECT * FROM t1;
+a id
+6 45
+45 50
+123 55
+347 60
+33101 65
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL DEFAULT '0',
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`),
+ KEY `id` (`id`,`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1
+INSERT INTO t1 SET a=123;
+INSERT INTO t1 VALUES(-123,-45);
+ALTER TABLE t1 AUTO_INCREMENT = 75;
+INSERT INTO t1 SET a=123;
+SELECT * FROM t1;
+a id
+-123 -45
+6 45
+45 50
+123 55
+347 60
+33101 65
+123 70
+123 75
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL DEFAULT '0',
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`),
+ KEY `id` (`id`,`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=latin1
+DROP TABLE t1;