mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge branch '5.5' into 10.1
This commit is contained in:
@@ -621,6 +621,130 @@ c1 c2
|
||||
3 3
|
||||
4 4
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#15851528 DUPLICATE KEY ERROR ON AUTO-INC PK WITH MIXED AUTO_INCREMENT_INCREMENT CLIENTS
|
||||
#
|
||||
# This test shows that the next record to be inserted is not affected
|
||||
# by a change in auto_increment_increment.
|
||||
# In addition, current value of auto_increment_increment by the client
|
||||
# that uses the existing autoinc value with be used to set next autoinc
|
||||
# value, which will be used by next client reguardless of its own session
|
||||
# setting for auto_increment_increment.
|
||||
#
|
||||
# Client 1: Insert a record with auto_increment_increment=2
|
||||
CREATE TABLE t(
|
||||
a SERIAL PRIMARY KEY,
|
||||
b VARCHAR(200)) ENGINE=InnoDB;
|
||||
SET SESSION auto_increment_increment=2;
|
||||
SHOW CREATE TABLE t;
|
||||
Table Create Table
|
||||
t CREATE TABLE `t` (
|
||||
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`b` varchar(200) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
INSERT INTO t(b) VALUES('S1');
|
||||
SELECT a,b FROM t;
|
||||
a b
|
||||
1 S1
|
||||
# Client 2: Insert records with auto_increment_increment 2,1
|
||||
SET SESSION auto_increment_increment=2;
|
||||
SHOW CREATE TABLE t;
|
||||
Table Create Table
|
||||
t CREATE TABLE `t` (
|
||||
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`b` varchar(200) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t(b) VALUES('S2');
|
||||
SELECT a,b FROM t;
|
||||
a b
|
||||
1 S1
|
||||
3 S2
|
||||
SET SESSION auto_increment_increment=1;
|
||||
SHOW CREATE TABLE t;
|
||||
Table Create Table
|
||||
t CREATE TABLE `t` (
|
||||
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`b` varchar(200) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t(b) VALUES('S2');
|
||||
SELECT a,b FROM t;
|
||||
a b
|
||||
1 S1
|
||||
3 S2
|
||||
4 S2
|
||||
# Client 1: Insert a record with auto_increment_increment=1
|
||||
SET SESSION auto_increment_increment=1;
|
||||
SHOW CREATE TABLE t;
|
||||
Table Create Table
|
||||
t CREATE TABLE `t` (
|
||||
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`b` varchar(200) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t(b) VALUES('S1');
|
||||
SELECT a,b FROM t;
|
||||
a b
|
||||
1 S1
|
||||
3 S2
|
||||
4 S2
|
||||
5 S1
|
||||
DROP TABLE t;
|
||||
# Autoincrement behaviour with mixed insert.
|
||||
CREATE TABLE t(
|
||||
a TINYINT AUTO_INCREMENT PRIMARY KEY,
|
||||
b VARCHAR(200)) ENGINE=InnoDB;
|
||||
SET SESSION auto_increment_increment=10;
|
||||
SHOW CREATE TABLE t;
|
||||
Table Create Table
|
||||
t CREATE TABLE `t` (
|
||||
`a` tinyint(4) NOT NULL AUTO_INCREMENT,
|
||||
`b` varchar(200) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
INSERT INTO t(b) VALUES('S0'),('S1');
|
||||
SHOW CREATE TABLE t;
|
||||
Table Create Table
|
||||
t CREATE TABLE `t` (
|
||||
`a` tinyint(4) NOT NULL AUTO_INCREMENT,
|
||||
`b` varchar(200) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t(a,b) VALUES(28,'S2');
|
||||
SET SESSION auto_increment_increment=1;
|
||||
SHOW CREATE TABLE t;
|
||||
Table Create Table
|
||||
t CREATE TABLE `t` (
|
||||
`a` tinyint(4) NOT NULL AUTO_INCREMENT,
|
||||
`b` varchar(200) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t(b) VALUES('S3');
|
||||
SHOW CREATE TABLE t;
|
||||
Table Create Table
|
||||
t CREATE TABLE `t` (
|
||||
`a` tinyint(4) NOT NULL AUTO_INCREMENT,
|
||||
`b` varchar(200) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t(b) VALUES('S4');
|
||||
SELECT * FROM t;
|
||||
a b
|
||||
1 S0
|
||||
11 S1
|
||||
22 S3
|
||||
23 S4
|
||||
28 S2
|
||||
SHOW CREATE TABLE t;
|
||||
Table Create Table
|
||||
t CREATE TABLE `t` (
|
||||
`a` tinyint(4) NOT NULL AUTO_INCREMENT,
|
||||
`b` varchar(200) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t;
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=5;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
Warnings:
|
||||
|
Reference in New Issue
Block a user