mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
Move InnoDB tests from storage/innobase/mysql-test/ (where they were ignored)
to mysql-test/
This commit is contained in:
parent
03bfca8559
commit
fb0c4b145a
105 changed files with 454 additions and 9322 deletions
|
@ -868,35 +868,6 @@ Got one of the listed errors
|
|||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
||||
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (null);
|
||||
INSERT INTO t1 VALUES (null);
|
||||
ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
|
||||
SELECT * FROM t1;
|
||||
d1
|
||||
1
|
||||
2
|
||||
SELECT * FROM t1;
|
||||
d1
|
||||
1
|
||||
2
|
||||
INSERT INTO t1 VALUES(null);
|
||||
Got one of the listed errors
|
||||
ALTER TABLE t1 AUTO_INCREMENT = 3;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`d1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`d1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES(null);
|
||||
SELECT * FROM t1;
|
||||
d1
|
||||
1
|
||||
2
|
||||
3
|
||||
DROP TABLE t1;
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
Variable_name Value
|
||||
auto_increment_increment 1
|
||||
|
@ -1111,18 +1082,165 @@ c1 c2
|
|||
3 innodb
|
||||
4 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE T1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
|
||||
CREATE INDEX i1 on T1(c2);
|
||||
SHOW CREATE TABLE T1;
|
||||
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
|
||||
CREATE INDEX i1 on t1(c2);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
T1 CREATE TABLE `T1` (
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`c2` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
KEY `i1` (`c2`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
|
||||
INSERT INTO T1 (c2) values (0);
|
||||
SELECT * FROM T1;
|
||||
INSERT INTO t1 (c2) values (0);
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
10 0
|
||||
DROP TABLE T1;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
CREATE TABLE t1(C1 DOUBLE AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
|
||||
INSERT INTO t1(C2) VALUES ('innodb');
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`C1` double NOT NULL AUTO_INCREMENT,
|
||||
`C2` char(10) DEFAULT NULL,
|
||||
PRIMARY KEY (`C1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(C1 FLOAT AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
|
||||
INSERT INTO t1(C2) VALUES ('innodb');
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`C1` float NOT NULL AUTO_INCREMENT,
|
||||
`C2` char(10) DEFAULT NULL,
|
||||
PRIMARY KEY (`C1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
CREATE TABLE t1 (c1 INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
|
||||
INSERT INTO t1 SET c1 = 1;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 SET c1 = 2;
|
||||
INSERT INTO t1 SET c1 = -1;
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
-1
|
||||
1
|
||||
2
|
||||
INSERT INTO t1 SET c1 = -1;
|
||||
Got one of the listed errors
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
|
||||
REPLACE INTO t1 VALUES (-1);
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
-1
|
||||
1
|
||||
2
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL);
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
-685113344
|
||||
1
|
||||
2
|
||||
3
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL);
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
-685113344
|
||||
2
|
||||
3
|
||||
4
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL);
|
||||
INSERT INTO t1 VALUES (4), (5), (6), (NULL);
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
-685113344
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5);
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
-685113344
|
||||
1
|
||||
2
|
||||
5
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL);
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
-685113344
|
||||
1
|
||||
2
|
||||
3
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -25,12 +25,6 @@ id x
|
|||
0 2
|
||||
commit;
|
||||
drop table t1;
|
||||
#
|
||||
# Old lock method (where LOCK TABLE was ignored by InnoDB) no longer
|
||||
# works due to fix for bugs #46272 "MySQL 5.4.4, new MDL: unnecessary
|
||||
# deadlock" and bug #37346 "innodb does not detect deadlock between
|
||||
# update and alter table".
|
||||
#
|
||||
set @@innodb_table_locks=0;
|
||||
create table t1 (id integer primary key, x integer) engine=INNODB;
|
||||
insert into t1 values(0, 0),(1,1),(2,2);
|
||||
|
@ -38,27 +32,26 @@ commit;
|
|||
SELECT * from t1 where id = 0 FOR UPDATE;
|
||||
id x
|
||||
0 0
|
||||
# Connection 'con2'.
|
||||
set autocommit=0;
|
||||
set @@innodb_table_locks=0;
|
||||
# The following statement should block because SQL-level lock
|
||||
# is taken on t1 which will wait until concurrent transaction
|
||||
# is commited.
|
||||
# Sending:
|
||||
lock table t1 write;;
|
||||
# Connection 'con1'.
|
||||
# Wait until LOCK TABLE is blocked on SQL-level lock.
|
||||
# We should be able to do UPDATEs and SELECTs within transaction.
|
||||
update t1 set x=1 where id = 0;
|
||||
lock table t1 write;
|
||||
update t1 set x=10 where id = 2;
|
||||
SELECT * from t1 where id = 2;
|
||||
id x
|
||||
2 2
|
||||
UPDATE t1 set x=3 where id = 2;
|
||||
commit;
|
||||
SELECT * from t1;
|
||||
id x
|
||||
0 0
|
||||
1 1
|
||||
2 3
|
||||
commit;
|
||||
unlock tables;
|
||||
commit;
|
||||
select * from t1;
|
||||
id x
|
||||
0 1
|
||||
0 0
|
||||
1 1
|
||||
2 2
|
||||
# Unblock LOCK TABLE.
|
||||
commit;
|
||||
# Connection 'con2'.
|
||||
# Reap LOCK TABLE.
|
||||
unlock tables;
|
||||
# Connection 'con1'.
|
||||
2 10
|
||||
drop table t1;
|
||||
|
|
|
@ -692,6 +692,9 @@ select count(*) from t1 where sca_pic is null;
|
|||
count(*)
|
||||
2
|
||||
alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
|
||||
ERROR 42000: Incorrect index name 'sca_pic'
|
||||
alter table t1 drop index sca_pic;
|
||||
alter table t1 add index sca_pic (cat_code, sca_pic);
|
||||
select count(*) from t1 where sca_code='PD' and sca_pic is null;
|
||||
count(*)
|
||||
1
|
||||
|
@ -699,6 +702,9 @@ select count(*) from t1 where cat_code='E';
|
|||
count(*)
|
||||
0
|
||||
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
|
||||
ERROR 42000: Incorrect index name 'sca_pic'
|
||||
alter table t1 drop index sca_pic;
|
||||
alter table t1 add index (sca_pic, cat_code);
|
||||
select count(*) from t1 where sca_code='PD' and sca_pic is null;
|
||||
count(*)
|
||||
1
|
||||
|
@ -1738,7 +1744,7 @@ count(*)
|
|||
drop table t1;
|
||||
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
|
||||
variable_value
|
||||
512
|
||||
8191
|
||||
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size';
|
||||
variable_value
|
||||
16384
|
||||
|
@ -1788,7 +1794,7 @@ Variable_name Value
|
|||
innodb_thread_concurrency 0
|
||||
set global innodb_thread_concurrency=1001;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect innodb_thread_concurrency value: '1001'
|
||||
Warning 1292 Truncated incorrect thread_concurrency value: '1001'
|
||||
show variables like "innodb_thread_concurrency";
|
||||
Variable_name Value
|
||||
innodb_thread_concurrency 1000
|
||||
|
@ -1809,7 +1815,7 @@ Variable_name Value
|
|||
innodb_concurrency_tickets 1000
|
||||
set global innodb_concurrency_tickets=0;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect innodb_concurrency_tickets value: '0'
|
||||
Warning 1292 Truncated incorrect concurrency_tickets value: '0'
|
||||
show variables like "innodb_concurrency_tickets";
|
||||
Variable_name Value
|
||||
innodb_concurrency_tickets 1
|
||||
|
@ -1833,6 +1839,7 @@ show variables like "innodb_thread_sleep_delay";
|
|||
Variable_name Value
|
||||
innodb_thread_sleep_delay 10000
|
||||
set storage_engine=INNODB;
|
||||
set session old_alter_table=1;
|
||||
drop table if exists t1,t2,t3;
|
||||
--- Testing varchar ---
|
||||
--- Testing varchar ---
|
||||
|
@ -1970,7 +1977,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a '
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref v v 13 const # Using where; Using index
|
||||
alter table t1 add unique(v);
|
||||
ERROR 23000: Duplicate entry 'v' for key 'v_2'
|
||||
ERROR 23000: Duplicate entry '{ ' for key 'v_2'
|
||||
alter table t1 add key(v);
|
||||
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
|
||||
qq
|
||||
|
@ -2406,6 +2413,7 @@ select * from t1 where a=20 and b is null;
|
|||
a b
|
||||
20 NULL
|
||||
drop table t1;
|
||||
set session old_alter_table=0;
|
||||
create table t1 (v varchar(65530), key(v));
|
||||
Warnings:
|
||||
Warning 1071 Specified key was too long; max key length is 767 bytes
|
||||
|
@ -2723,7 +2731,7 @@ create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb;
|
|||
create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb;
|
||||
insert into t1 values (0x41),(0x4120),(0x4100);
|
||||
insert into t2 values (0x41),(0x4120),(0x4100);
|
||||
ERROR 23000: Duplicate entry 'A\x00' for key 'PRIMARY'
|
||||
ERROR 23000: Duplicate entry 'A' for key 'PRIMARY'
|
||||
insert into t2 values (0x41),(0x4120);
|
||||
insert into t3 values (0x41),(0x4120),(0x4100);
|
||||
ERROR 23000: Duplicate entry 'A ' for key 'PRIMARY'
|
||||
|
@ -2834,10 +2842,10 @@ t2 CREATE TABLE `t2` (
|
|||
DROP TABLE t2,t1;
|
||||
create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
|
||||
insert into t1(a) values (1),(2),(3);
|
||||
create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
|
||||
commit;
|
||||
set autocommit = 0;
|
||||
update t1 set b = 5 where a = 2;
|
||||
create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
|
||||
set autocommit = 0;
|
||||
insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100),
|
||||
(11),(21),(31),(41),(51),(61),(71),(81),(91),(101),
|
||||
|
@ -2885,7 +2893,6 @@ insert into t2(a) values(8);
|
|||
delete from t2 where a = 3;
|
||||
update t4 set b = b + 1 where a = 3;
|
||||
commit;
|
||||
commit;
|
||||
drop trigger t1t;
|
||||
drop trigger t2t;
|
||||
drop trigger t3t;
|
||||
|
|
|
@ -25,8 +25,8 @@ ALTER TABLE t1 CHANGE a c INT;
|
|||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150)
|
||||
# Ensure that online column rename works.
|
||||
ALTER TABLE t1 CHANGE b c INT;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
affected rows: 3
|
||||
info: Records: 3 Duplicates: 0 Warnings: 0
|
||||
|
||||
# Test renaming the column in the referencing table
|
||||
|
||||
|
@ -34,8 +34,8 @@ ALTER TABLE t2 CHANGE a c INT;
|
|||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
|
||||
# Ensure that online column rename works.
|
||||
ALTER TABLE t2 CHANGE b c INT;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
affected rows: 3
|
||||
info: Records: 3 Duplicates: 0 Warnings: 0
|
||||
|
||||
# Test with self-referential constraints
|
||||
|
||||
|
@ -45,8 +45,8 @@ ALTER TABLE t3 CHANGE b d INT;
|
|||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150)
|
||||
# Ensure that online column rename works.
|
||||
ALTER TABLE t3 CHANGE c d INT;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
affected rows: 3
|
||||
info: Records: 3 Duplicates: 0 Warnings: 0
|
||||
|
||||
# Cleanup.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
set global innodb_commit_concurrency=0;
|
||||
ERROR 42000: Variable 'innodb_commit_concurrency' can't be set to the value of '0'
|
||||
ERROR HY000: Incorrect arguments to SET
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
1
|
||||
|
@ -16,7 +16,7 @@ select @@innodb_commit_concurrency;
|
|||
@@innodb_commit_concurrency
|
||||
1
|
||||
set global innodb_commit_concurrency=0;
|
||||
ERROR 42000: Variable 'innodb_commit_concurrency' can't be set to the value of '0'
|
||||
ERROR HY000: Incorrect arguments to SET
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
1
|
||||
|
|
|
@ -3,12 +3,12 @@ select @@innodb_commit_concurrency;
|
|||
@@innodb_commit_concurrency
|
||||
0
|
||||
set global innodb_commit_concurrency=1;
|
||||
ERROR 42000: Variable 'innodb_commit_concurrency' can't be set to the value of '1'
|
||||
ERROR HY000: Incorrect arguments to SET
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
0
|
||||
set global innodb_commit_concurrency=42;
|
||||
ERROR 42000: Variable 'innodb_commit_concurrency' can't be set to the value of '42'
|
||||
ERROR HY000: Incorrect arguments to SET
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
0
|
||||
|
|
|
@ -2,8 +2,7 @@ CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
|
|||
ALTER TABLE bug44571 CHANGE foo bar INT;
|
||||
ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
|
||||
ERROR 42000: Key column 'foo' doesn't exist in table
|
||||
ALTER TABLE bug44571 ADD INDEX bug44571b (bar);
|
||||
ERROR HY000: Incorrect key file for table 'bug44571'; try to repair it
|
||||
CREATE INDEX bug44571b ON bug44571 (bar);
|
||||
ERROR HY000: Incorrect key file for table 'bug44571'; try to repair it
|
||||
ALTER TABLE bug44571 ADD INDEX bug44571c (bar);
|
||||
DROP INDEX bug44571c ON bug44571;
|
||||
CREATE INDEX bug44571c ON bug44571 (bar);
|
||||
DROP TABLE bug44571;
|
||||
|
|
|
@ -478,28 +478,6 @@ INSERT INTO t2 SELECT c1 FROM t1;
|
|||
INSERT INTO t2 SELECT NULL FROM t1;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
#
|
||||
# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from
|
||||
# the index (PRIMARY)
|
||||
# This test requires a restart of the server
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
||||
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (null);
|
||||
INSERT INTO t1 VALUES (null);
|
||||
ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
|
||||
SELECT * FROM t1;
|
||||
# Restart the server
|
||||
-- source include/restart_mysqld.inc
|
||||
# The MySQL and InnoDB data dictionaries should now be out of sync.
|
||||
# The select should print message to the error log
|
||||
SELECT * FROM t1;
|
||||
-- error ER_AUTOINC_READ_FAILED,1467
|
||||
INSERT INTO t1 VALUES(null);
|
||||
ALTER TABLE t1 AUTO_INCREMENT = 3;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES(null);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# If the user has specified negative values for an AUTOINC column then
|
||||
# InnoDB should ignore those values when setting the table's max value.
|
||||
|
@ -610,9 +588,77 @@ DROP TABLE t1;
|
|||
# 47125: auto_increment start value is ignored if an index is created
|
||||
# and engine=innodb
|
||||
#
|
||||
CREATE TABLE T1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
|
||||
CREATE INDEX i1 on T1(c2);
|
||||
SHOW CREATE TABLE T1;
|
||||
INSERT INTO T1 (c2) values (0);
|
||||
SELECT * FROM T1;
|
||||
DROP TABLE T1;
|
||||
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
|
||||
CREATE INDEX i1 on t1(c2);
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (c2) values (0);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
##
|
||||
# 49032: Use the correct function to read the AUTOINC column value
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1(C1 DOUBLE AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
|
||||
# Restart the server
|
||||
-- source include/restart_mysqld.inc
|
||||
INSERT INTO t1(C2) VALUES ('innodb');
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(C1 FLOAT AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
|
||||
# Restart the server
|
||||
-- source include/restart_mysqld.inc
|
||||
INSERT INTO t1(C2) VALUES ('innodb');
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
##
|
||||
# 47720: REPLACE INTO Autoincrement column with negative values
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (c1 INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
|
||||
INSERT INTO t1 SET c1 = 1;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 SET c1 = 2;
|
||||
INSERT INTO t1 SET c1 = -1;
|
||||
SELECT * FROM t1;
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
INSERT INTO t1 SET c1 = -1;
|
||||
SHOW CREATE TABLE t1;
|
||||
REPLACE INTO t1 VALUES (-1);
|
||||
SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
##
|
||||
# 49497: Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL);
|
||||
SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL);
|
||||
SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL);
|
||||
INSERT INTO t1 VALUES (4), (5), (6), (NULL);
|
||||
SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5);
|
||||
SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL);
|
||||
SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -1 +1 @@
|
|||
--innodb_lock_wait_timeout=2
|
||||
--loose-innodb_lock_wait_timeout=2
|
||||
|
|
|
@ -1,58 +1,58 @@
|
|||
-- source include/not_embedded.inc
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
# REPLACE INTO ... SELECT and INSERT INTO ... SELECT should do
|
||||
# a consistent read of the source table.
|
||||
|
||||
connect (a,localhost,root,,);
|
||||
connect (b,localhost,root,,);
|
||||
connection a;
|
||||
set session transaction isolation level read committed;
|
||||
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
|
||||
create table t2 like t1;
|
||||
insert into t2 values (1),(2),(3),(4),(5),(6),(7);
|
||||
set autocommit=0;
|
||||
|
||||
# REPLACE INTO ... SELECT case
|
||||
begin;
|
||||
# this should not result in any locks on t2.
|
||||
replace into t1 select * from t2;
|
||||
|
||||
connection b;
|
||||
set session transaction isolation level read committed;
|
||||
set autocommit=0;
|
||||
# should not cuase a lock wait.
|
||||
delete from t2 where a=5;
|
||||
commit;
|
||||
delete from t2;
|
||||
commit;
|
||||
connection a;
|
||||
commit;
|
||||
|
||||
# INSERT INTO ... SELECT case
|
||||
begin;
|
||||
# this should not result in any locks on t2.
|
||||
insert into t1 select * from t2;
|
||||
|
||||
connection b;
|
||||
set session transaction isolation level read committed;
|
||||
set autocommit=0;
|
||||
# should not cuase a lock wait.
|
||||
delete from t2 where a=5;
|
||||
commit;
|
||||
delete from t2;
|
||||
commit;
|
||||
connection a;
|
||||
commit;
|
||||
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
|
||||
connection default;
|
||||
disconnect a;
|
||||
disconnect b;
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
# REPLACE INTO ... SELECT and INSERT INTO ... SELECT should do
|
||||
# a consistent read of the source table.
|
||||
|
||||
connect (a,localhost,root,,);
|
||||
connect (b,localhost,root,,);
|
||||
connection a;
|
||||
set session transaction isolation level read committed;
|
||||
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
|
||||
create table t2 like t1;
|
||||
insert into t2 values (1),(2),(3),(4),(5),(6),(7);
|
||||
set autocommit=0;
|
||||
|
||||
# REPLACE INTO ... SELECT case
|
||||
begin;
|
||||
# this should not result in any locks on t2.
|
||||
replace into t1 select * from t2;
|
||||
|
||||
connection b;
|
||||
set session transaction isolation level read committed;
|
||||
set autocommit=0;
|
||||
# should not cause a lock wait.
|
||||
delete from t2 where a=5;
|
||||
commit;
|
||||
delete from t2;
|
||||
commit;
|
||||
connection a;
|
||||
commit;
|
||||
|
||||
# INSERT INTO ... SELECT case
|
||||
begin;
|
||||
# this should not result in any locks on t2.
|
||||
insert into t1 select * from t2;
|
||||
|
||||
connection b;
|
||||
set session transaction isolation level read committed;
|
||||
set autocommit=0;
|
||||
# should not cause a lock wait.
|
||||
delete from t2 where a=5;
|
||||
commit;
|
||||
delete from t2;
|
||||
commit;
|
||||
connection a;
|
||||
commit;
|
||||
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
|
||||
connection default;
|
||||
disconnect a;
|
||||
disconnect b;
|
||||
|
|
|
@ -56,12 +56,9 @@ commit;
|
|||
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # Old lock method (where LOCK TABLE was ignored by InnoDB) no longer
|
||||
--echo # works due to fix for bugs #46272 "MySQL 5.4.4, new MDL: unnecessary
|
||||
--echo # deadlock" and bug #37346 "innodb does not detect deadlock between
|
||||
--echo # update and alter table".
|
||||
--echo #
|
||||
#
|
||||
# Try with old lock method (where LOCK TABLE is ignored by InnoDB)
|
||||
#
|
||||
|
||||
set @@innodb_table_locks=0;
|
||||
|
||||
|
@ -70,38 +67,36 @@ insert into t1 values(0, 0),(1,1),(2,2);
|
|||
commit;
|
||||
SELECT * from t1 where id = 0 FOR UPDATE;
|
||||
|
||||
--echo # Connection 'con2'.
|
||||
connection con2;
|
||||
set autocommit=0;
|
||||
set @@innodb_table_locks=0;
|
||||
|
||||
--echo # The following statement should block because SQL-level lock
|
||||
--echo # is taken on t1 which will wait until concurrent transaction
|
||||
--echo # is commited.
|
||||
--echo # Sending:
|
||||
--send lock table t1 write;
|
||||
# The following statement should work becase innodb doesn't check table locks
|
||||
lock table t1 write;
|
||||
|
||||
--echo # Connection 'con1'.
|
||||
connection con1;
|
||||
--echo # Wait until LOCK TABLE is blocked on SQL-level lock.
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "Waiting for table" and info = "lock table t1 write";
|
||||
--source include/wait_condition.inc
|
||||
--echo # We should be able to do UPDATEs and SELECTs within transaction.
|
||||
update t1 set x=1 where id = 0;
|
||||
select * from t1;
|
||||
--echo # Unblock LOCK TABLE.
|
||||
commit;
|
||||
|
||||
--echo # Connection 'con2'.
|
||||
# This will be locked by MySQL
|
||||
--send
|
||||
update t1 set x=10 where id = 2;
|
||||
--sleep 2
|
||||
|
||||
connection con2;
|
||||
--echo # Reap LOCK TABLE.
|
||||
--reap
|
||||
|
||||
# Note that we will get a deadlock if we try to select any rows marked
|
||||
# for update by con1 !
|
||||
|
||||
SELECT * from t1 where id = 2;
|
||||
UPDATE t1 set x=3 where id = 2;
|
||||
commit;
|
||||
SELECT * from t1;
|
||||
commit;
|
||||
unlock tables;
|
||||
|
||||
--echo # Connection 'con1'.
|
||||
connection con1;
|
||||
reap;
|
||||
commit;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
|
||||
# Save the original values of some variables in order to be able to
|
||||
# estimate how much they have changed during the tests. Previously this
|
||||
# test assumed that e.g. rows_deleted is 0 here and after deleting 23
|
||||
|
@ -425,11 +427,19 @@ INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca
|
|||
select count(*) from t1 where sca_code = 'PD';
|
||||
select count(*) from t1 where sca_code <= 'PD';
|
||||
select count(*) from t1 where sca_pic is null;
|
||||
# this should be fixed by MySQL (see Bug #51451)
|
||||
--error ER_WRONG_NAME_FOR_INDEX
|
||||
alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
|
||||
alter table t1 drop index sca_pic;
|
||||
alter table t1 add index sca_pic (cat_code, sca_pic);
|
||||
select count(*) from t1 where sca_code='PD' and sca_pic is null;
|
||||
select count(*) from t1 where cat_code='E';
|
||||
|
||||
# this should be fixed by MySQL (see Bug #51451)
|
||||
--error ER_WRONG_NAME_FOR_INDEX
|
||||
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
|
||||
alter table t1 drop index sca_pic;
|
||||
alter table t1 add index (sca_pic, cat_code);
|
||||
select count(*) from t1 where sca_code='PD' and sca_pic is null;
|
||||
select count(*) from t1 where sca_pic >= 'n';
|
||||
select sca_pic from t1 where sca_pic is null;
|
||||
|
@ -1317,7 +1327,7 @@ drop table t1;
|
|||
|
||||
# Test for testable InnoDB status variables. This test
|
||||
# uses previous ones(pages_created, rows_deleted, ...).
|
||||
--replace_result 511 512
|
||||
--replace_result 8192 8191
|
||||
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
|
||||
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size';
|
||||
SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted';
|
||||
|
@ -1375,7 +1385,10 @@ show variables like "innodb_thread_sleep_delay";
|
|||
|
||||
let $default=`select @@storage_engine`;
|
||||
set storage_engine=INNODB;
|
||||
# this should be fixed by MySQL (see Bug #51451)
|
||||
set session old_alter_table=1;
|
||||
source include/varchar.inc;
|
||||
set session old_alter_table=0;
|
||||
|
||||
#
|
||||
# Some errors/warnings on create
|
||||
|
@ -1700,7 +1713,7 @@ set foreign_key_checks=0;
|
|||
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
|
||||
create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8;
|
||||
# Embedded server doesn't chdir to data directory
|
||||
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
|
||||
--replace_result $MYSQLD_DATADIR ./ master-data/ ''
|
||||
-- error 1025
|
||||
rename table t3 to t1;
|
||||
set foreign_key_checks=1;
|
||||
|
@ -1854,15 +1867,16 @@ connect (b,localhost,root,,);
|
|||
connection a;
|
||||
create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
|
||||
insert into t1(a) values (1),(2),(3);
|
||||
delimiter |;
|
||||
create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
|
||||
delimiter ;|
|
||||
commit;
|
||||
connection b;
|
||||
set autocommit = 0;
|
||||
update t1 set b = 5 where a = 2;
|
||||
connection a;
|
||||
delimiter |;
|
||||
create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
|
||||
delimiter ;|
|
||||
set autocommit = 0;
|
||||
connection a;
|
||||
insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100),
|
||||
(11),(21),(31),(41),(51),(61),(71),(81),(91),(101),
|
||||
(12),(22),(32),(42),(52),(62),(72),(82),(92),(102),
|
||||
|
@ -1926,9 +1940,6 @@ insert into t2(a) values(8);
|
|||
delete from t2 where a = 3;
|
||||
update t4 set b = b + 1 where a = 3;
|
||||
commit;
|
||||
connection a;
|
||||
commit;
|
||||
connection b;
|
||||
drop trigger t1t;
|
||||
drop trigger t2t;
|
||||
drop trigger t3t;
|
||||
|
@ -2342,7 +2353,7 @@ ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL;
|
|||
# mysqltest first does replace_regex, then replace_result
|
||||
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
|
||||
# Embedded server doesn't chdir to data directory
|
||||
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
|
||||
--replace_result $MYSQLD_DATADIR ./ master-data/ ''
|
||||
--error 1025
|
||||
ALTER TABLE t2 MODIFY a INT NOT NULL;
|
||||
DELETE FROM t1;
|
||||
|
|
|
@ -16,6 +16,7 @@ CREATE TABLE bug38231 (a INT);
|
|||
|
||||
-- connect (con1,localhost,root,,)
|
||||
-- connect (con2,localhost,root,,)
|
||||
-- connect (con3,localhost,root,,)
|
||||
|
||||
-- connection con1
|
||||
SET autocommit=0;
|
||||
|
@ -26,15 +27,45 @@ SET autocommit=0;
|
|||
-- send
|
||||
LOCK TABLE bug38231 WRITE;
|
||||
|
||||
# When con1 does UNLOCK below this will release either con2 or con3 which are
|
||||
# both waiting on LOCK. At the end we must first --reap and UNLOCK the
|
||||
# connection that has been released, otherwise it will wait forever. We assume
|
||||
# that the released connection will be the first one that has gained the LOCK,
|
||||
# thus we force the order here - con2 does LOCK first, then con3. In other
|
||||
# words we wait for LOCK from con2 above to be exected before doing LOCK in
|
||||
# con3.
|
||||
-- connection con1
|
||||
let $wait_condition =
|
||||
SELECT COUNT(*) = 1 FROM information_schema.processlist
|
||||
WHERE info = 'LOCK TABLE bug38231 WRITE';
|
||||
-- source include/wait_condition.inc
|
||||
# the above enables query log, re-disable it
|
||||
-- disable_query_log
|
||||
|
||||
-- connection con3
|
||||
SET autocommit=0;
|
||||
-- send
|
||||
LOCK TABLE bug38231 WRITE;
|
||||
|
||||
-- connection default
|
||||
-- send
|
||||
TRUNCATE TABLE bug38231;
|
||||
|
||||
-- connection con1
|
||||
# give time to TRUNCATE and others to be executed; without sleep, sometimes
|
||||
# UNLOCK executes before TRUNCATE
|
||||
# TODO: Replace with wait_condition once possible under embedded server.
|
||||
-- sleep 0.2
|
||||
# Wait for TRUNCATE and the other two LOCKs to be executed; without this,
|
||||
# sometimes UNLOCK executes before them. We assume there are no other
|
||||
# sessions executing at the same time with the same SQL commands.
|
||||
let $wait_condition =
|
||||
SELECT COUNT(*) = 1 FROM information_schema.processlist
|
||||
WHERE info = 'TRUNCATE TABLE bug38231';
|
||||
-- source include/wait_condition.inc
|
||||
let $wait_condition =
|
||||
SELECT COUNT(*) = 2 FROM information_schema.processlist
|
||||
WHERE info = 'LOCK TABLE bug38231 WRITE';
|
||||
-- source include/wait_condition.inc
|
||||
# the above enables query log, re-disable it
|
||||
-- disable_query_log
|
||||
|
||||
# this crashes the server if the bug is present
|
||||
UNLOCK TABLES;
|
||||
|
||||
|
@ -44,10 +75,16 @@ UNLOCK TABLES;
|
|||
-- reap
|
||||
UNLOCK TABLES;
|
||||
|
||||
-- connection con3
|
||||
-- reap
|
||||
UNLOCK TABLES;
|
||||
|
||||
-- connection default
|
||||
-- reap
|
||||
|
||||
-- disconnect con1
|
||||
-- disconnect con2
|
||||
-- disconnect con3
|
||||
|
||||
# test that TRUNCATE works with with row-level locks
|
||||
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
--disable_query_log
|
||||
call mtr.add_suppression("InnoDB: Error: table 'test/bug39438'");
|
||||
--enable_query_log
|
||||
|
||||
SET storage_engine=InnoDB;
|
||||
|
||||
# we care only that the following SQL commands do not crash the server
|
||||
|
@ -23,7 +19,31 @@ DROP TABLE IF EXISTS bug39438;
|
|||
|
||||
CREATE TABLE bug39438 (id INT) ENGINE=INNODB;
|
||||
|
||||
ALTER TABLE bug39438 DISCARD TABLESPACE;
|
||||
# remove: XXX Uncomment the following ALTER and remove those lines after
|
||||
# remove: applying the patch.
|
||||
# remove: Obviously this test is useless without this ALTER command,
|
||||
# remove: but it causes warnings to be printed by mysqld and the whole
|
||||
# remove: mysql-test suite fails at the end (returns non-zero). Please
|
||||
# remove: apply this patch to the mysql source tree, remove those lines
|
||||
# remove: and uncomment the following ALTER. We do not care about the
|
||||
# remove: warnings, this test is to ensure mysqld does not crash.
|
||||
# remove: === modified file 'mysql-test/lib/mtr_report.pl'
|
||||
# remove: --- mysql-test/lib/mtr_report.pl 2008-08-12 10:26:23 +0000
|
||||
# remove: +++ mysql-test/lib/mtr_report.pl 2008-10-01 11:57:41 +0000
|
||||
# remove: @@ -412,7 +412,10 @@
|
||||
# remove:
|
||||
# remove: # When trying to set lower_case_table_names = 2
|
||||
# remove: # on a case sensitive file system. Bug#37402.
|
||||
# remove: - /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./
|
||||
# remove: + /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./ or
|
||||
# remove: +
|
||||
# remove: + # this test is expected to print warnings
|
||||
# remove: + ($testname eq 'main.innodb_bug39438')
|
||||
# remove: )
|
||||
# remove: {
|
||||
# remove: next; # Skip these lines
|
||||
# remove:
|
||||
#ALTER TABLE bug39438 DISCARD TABLESPACE;
|
||||
|
||||
# this crashes the server if the bug is present
|
||||
SHOW TABLE STATUS;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
set global innodb_commit_concurrency=0;
|
||||
select @@innodb_commit_concurrency;
|
||||
set global innodb_commit_concurrency=1;
|
||||
|
@ -14,7 +14,7 @@ set global innodb_commit_concurrency=42;
|
|||
select @@innodb_commit_concurrency;
|
||||
set global innodb_commit_concurrency=DEFAULT;
|
||||
select @@innodb_commit_concurrency;
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
set global innodb_commit_concurrency=0;
|
||||
select @@innodb_commit_concurrency;
|
||||
set global innodb_commit_concurrency=1;
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
set global innodb_commit_concurrency=0;
|
||||
select @@innodb_commit_concurrency;
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
set global innodb_commit_concurrency=1;
|
||||
select @@innodb_commit_concurrency;
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
set global innodb_commit_concurrency=42;
|
||||
select @@innodb_commit_concurrency;
|
||||
set global innodb_commit_concurrency=0;
|
||||
|
|
|
@ -1,17 +1,22 @@
|
|||
#
|
||||
# Bug#44571 InnoDB Plugin crashes on ADD INDEX
|
||||
# http://bugs.mysql.com/44571
|
||||
# Please also refer to related fix in
|
||||
# http://bugs.mysql.com/47621
|
||||
#
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
|
||||
ALTER TABLE bug44571 CHANGE foo bar INT;
|
||||
# Create index with the old column name will fail,
|
||||
# because the CHANGE foo bar is successful. And
|
||||
# the column name change would communicate to
|
||||
# InnoDB with the fix from bug #47621
|
||||
-- error ER_KEY_COLUMN_DOES_NOT_EXITS
|
||||
ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
|
||||
# The following will fail, because the CHANGE foo bar was
|
||||
# not communicated to InnoDB.
|
||||
--error ER_NOT_KEYFILE
|
||||
ALTER TABLE bug44571 ADD INDEX bug44571b (bar);
|
||||
--error ER_NOT_KEYFILE
|
||||
CREATE INDEX bug44571b ON bug44571 (bar);
|
||||
# The following create indexes should succeed,
|
||||
# indirectly confirm the CHANGE foo bar is successful.
|
||||
ALTER TABLE bug44571 ADD INDEX bug44571c (bar);
|
||||
DROP INDEX bug44571c ON bug44571;
|
||||
CREATE INDEX bug44571c ON bug44571 (bar);
|
||||
DROP TABLE bug44571;
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
#
|
||||
# Bug#11650: LIKE pattern matching using prefix index
|
||||
# doesn't return correct result
|
||||
#
|
||||
--disable_warnings
|
||||
#
|
||||
# This query creates a column using
|
||||
# character_set_connection and
|
||||
# collation_connection.
|
||||
#
|
||||
create table t1 engine=innodb select repeat('a',50) as c1;
|
||||
--enable_warnings
|
||||
alter table t1 add index(c1(5));
|
||||
|
||||
insert into t1 values ('abcdefg'),('abcde100'),('abcde110'),('abcde111');
|
||||
select collation(c1) from t1 limit 1;
|
||||
select c1 from t1 where c1 like 'abcdef%' order by c1;
|
||||
select c1 from t1 where c1 like 'abcde1%' order by c1;
|
||||
select c1 from t1 where c1 like 'abcde11%' order by c1;
|
||||
select c1 from t1 where c1 like 'abcde111%' order by c1;
|
||||
drop table t1;
|
|
@ -1,4 +0,0 @@
|
|||
disable_query_log;
|
||||
--require r/true.require
|
||||
select (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') as `TRUE` from information_schema.engines where engine = 'innodb';
|
||||
enable_query_log;
|
File diff suppressed because it is too large
Load diff
|
@ -1,664 +0,0 @@
|
|||
-- source include/have_innodb.inc
|
||||
# embedded server ignores 'delayed', so skip this
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Bug #34335
|
||||
#
|
||||
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (9223372036854775807, null);
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
## Test AUTOINC overflow
|
||||
##
|
||||
|
||||
# TINYINT
|
||||
CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (127, null);
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (255, null);
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# SMALLINT
|
||||
#
|
||||
CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (32767, null);
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (65535, null);
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MEDIUMINT
|
||||
#
|
||||
CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (8388607, null);
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (16777215, null);
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# INT
|
||||
#
|
||||
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (2147483647, null);
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (4294967295, null);
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BIGINT
|
||||
#
|
||||
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (9223372036854775807, null);
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (18446744073709551615, null);
|
||||
-- error ER_AUTOINC_READ_FAILED,1467
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug 37531
|
||||
# After truncate, auto_increment behaves incorrectly for InnoDB
|
||||
#
|
||||
CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SELECT c1 FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
TRUNCATE TABLE t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SELECT c1 FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Deleting all records should not reset the AUTOINC counter.
|
||||
#
|
||||
CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SELECT c1 FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DELETE FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SELECT c1 FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug 38839
|
||||
# Reset the last value generated at end of statement
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (NULL, 1);
|
||||
DELETE FROM t1 WHERE c1 = 1;
|
||||
INSERT INTO t1 VALUES (2,1);
|
||||
INSERT INTO t1 VALUES (NULL,8);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
# Bug 38839 -- same as above but for multi value insert
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (NULL, 1);
|
||||
DELETE FROM t1 WHERE c1 = 1;
|
||||
INSERT INTO t1 VALUES (2,1), (NULL, 8);
|
||||
INSERT INTO t1 VALUES (NULL,9);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Test changes to AUTOINC next value calculation
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (NULL),(5),(NULL);
|
||||
INSERT INTO t1 VALUES (250),(NULL);
|
||||
SELECT * FROM t1;
|
||||
INSERT INTO t1 VALUES (1000);
|
||||
SET @@INSERT_ID=400;
|
||||
INSERT INTO t1 VALUES(NULL),(NULL);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Test with SIGNED INT column, by inserting a 0 for the first column value
|
||||
# 0 is treated in the same was NULL.
|
||||
# Reset the AUTOINC session variables
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
||||
SET @@INSERT_ID=1;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(0);
|
||||
SELECT * FROM t1;
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
|
||||
INSERT INTO t1 VALUES (-1), (NULL),(2),(NULL);
|
||||
INSERT INTO t1 VALUES (250),(NULL);
|
||||
SELECT * FROM t1;
|
||||
SET @@INSERT_ID=400;
|
||||
# Duplicate error expected here for autoinc_lock_mode != TRADITIONAL
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
INSERT INTO t1 VALUES(NULL),(NULL);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Test with SIGNED INT column
|
||||
# Reset the AUTOINC session variables
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
||||
SET @@INSERT_ID=1;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(-1);
|
||||
SELECT * FROM t1;
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
INSERT INTO t1 VALUES (-2), (NULL),(2),(NULL);
|
||||
INSERT INTO t1 VALUES (250),(NULL);
|
||||
SELECT * FROM t1;
|
||||
INSERT INTO t1 VALUES (1000);
|
||||
SET @@INSERT_ID=400;
|
||||
INSERT INTO t1 VALUES(NULL),(NULL);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Test with UNSIGNED INT column, single insert
|
||||
# The sign in the value is ignored and a new column value is generated
|
||||
# Reset the AUTOINC session variables
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
||||
SET @@INSERT_ID=1;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(-1);
|
||||
SELECT * FROM t1;
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
INSERT INTO t1 VALUES (-2);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (250);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1;
|
||||
INSERT INTO t1 VALUES (1000);
|
||||
SET @@INSERT_ID=400;
|
||||
INSERT INTO t1 VALUES(NULL);
|
||||
INSERT INTO t1 VALUES(NULL);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Test with UNSIGNED INT column, multi-value inserts
|
||||
# The sign in the value is ignored and a new column value is generated
|
||||
# Reset the AUTOINC session variables
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
||||
SET @@INSERT_ID=1;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(-1);
|
||||
SELECT * FROM t1;
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
INSERT INTO t1 VALUES (-2),(NULL),(2),(NULL);
|
||||
INSERT INTO t1 VALUES (250),(NULL);
|
||||
SELECT * FROM t1;
|
||||
INSERT INTO t1 VALUES (1000);
|
||||
SET @@INSERT_ID=400;
|
||||
# Duplicate error expected here for autoinc_lock_mode != TRADITIONAL
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
INSERT INTO t1 VALUES(NULL),(NULL);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Check for overflow handling when increment is > 1
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
||||
SET @@INSERT_ID=1;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
||||
# TODO: Fix the autoinc init code
|
||||
# We have to do this because of a bug in the AUTOINC init code.
|
||||
INSERT INTO t1 VALUES(NULL);
|
||||
INSERT INTO t1 VALUES (9223372036854775794); #-- 2^63 - 14
|
||||
SELECT * FROM t1;
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
# This should just fit
|
||||
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Check for overflow handling when increment and offser are > 1
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
||||
SET @@INSERT_ID=1;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
||||
# TODO: Fix the autoinc init code
|
||||
# We have to do this because of a bug in the AUTOINC init code.
|
||||
INSERT INTO t1 VALUES(NULL);
|
||||
INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13
|
||||
SELECT * FROM t1;
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
# This should fail because of overflow but it doesn't, it seems to be
|
||||
# a MySQL server bug. It wraps around to 0 for the last value.
|
||||
# See MySQL Bug# 39828
|
||||
#
|
||||
# Instead of wrapping around, it asserts when MySQL is compiled --with-debug
|
||||
# (see sql/handler.cc:handler::update_auto_increment()). Don't test for
|
||||
# overflow until Bug #39828 is fixed.
|
||||
#
|
||||
# Since this asserts when compiled --with-debug, we can't properly test this
|
||||
# until Bug #39828 is fixed. For now, this test is meaningless.
|
||||
#if Bug #39828 is fixed
|
||||
#INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
|
||||
#else
|
||||
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
|
||||
#endif
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Check for overflow handling when increment and offset are odd numbers
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
||||
SET @@INSERT_ID=1;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
||||
# TODO: Fix the autoinc init code
|
||||
# We have to do this because of a bug in the AUTOINC init code.
|
||||
INSERT INTO t1 VALUES(NULL);
|
||||
INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13
|
||||
SELECT * FROM t1;
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
# This should fail because of overflow but it doesn't. It fails with
|
||||
# a duplicate entry message because of a MySQL server bug, it wraps
|
||||
# around. See MySQL Bug# 39828, once MySQL fix the bug we can replace
|
||||
# the ER_DUP_ENTRY, 1062 below with the appropriate error message
|
||||
#
|
||||
# Since this asserts when compiled --with-debug, we can't properly test this
|
||||
# until Bug #39828 is fixed. For now, this test is meaningless.
|
||||
#if Bug #39828 is fixed
|
||||
# Still need to fix this error code, error should mention overflow
|
||||
#-- error ER_DUP_ENTRY,1062
|
||||
#INSERT INTO t1 VALUES (NULL),(NULL), (NULL);
|
||||
#else
|
||||
INSERT INTO t1 VALUES (NULL),(NULL);
|
||||
#endif
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Check for overflow handling when increment and offset are odd numbers
|
||||
# and check for large -ve numbers
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
||||
SET @@INSERT_ID=1;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
||||
# TODO: Fix the autoinc init code
|
||||
# We have to do this because of a bug in the AUTOINC init code.
|
||||
INSERT INTO t1 VALUES(NULL);
|
||||
INSERT INTO t1 VALUES(-9223372036854775806); #-- -2^63 + 2
|
||||
INSERT INTO t1 VALUES(-9223372036854775807); #-- -2^63 + 1
|
||||
INSERT INTO t1 VALUES(-9223372036854775808); #-- -2^63
|
||||
SELECT * FROM t1;
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=3, @@SESSION.AUTO_INCREMENT_OFFSET=3;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
INSERT INTO t1 VALUES (NULL),(NULL), (NULL);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Check for overflow handling when increment and offset are very
|
||||
# large numbers 2^60
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
||||
SET @@INSERT_ID=1;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
||||
# TODO: Fix the autoinc init code
|
||||
# We have to do this because of a bug in the AUTOINC init code.
|
||||
INSERT INTO t1 VALUES(NULL);
|
||||
INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2
|
||||
SELECT * FROM t1;
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
# This should fail because of overflow but it doesn't. It wraps around
|
||||
# and the autoinc values look bogus too.
|
||||
# See MySQL Bug# 39828, once MySQL fix the bug we can enable the error
|
||||
# code expected test.
|
||||
# -- error ER_AUTOINC_READ_FAILED,1467
|
||||
#
|
||||
# Since this asserts when compiled --with-debug, we can't properly test this
|
||||
# until Bug #39828 is fixed. For now, this test is meaningless.
|
||||
#if Bug #39828 is fixed
|
||||
#-- error ER_AUTOINC_READ_FAILED,1467
|
||||
#INSERT INTO t1 VALUES (NULL),(NULL);
|
||||
#else
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
#endif
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Check for floating point autoinc column handling
|
||||
#
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
||||
SET @@INSERT_ID=1;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
CREATE TABLE t1 (c1 DOUBLE NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(NULL, 1);
|
||||
INSERT INTO t1 VALUES(NULL, 2);
|
||||
SELECT * FROM t1;
|
||||
ALTER TABLE t1 CHANGE c1 c1 SERIAL;
|
||||
SELECT * FROM t1;
|
||||
INSERT INTO t1 VALUES(NULL, 3);
|
||||
INSERT INTO t1 VALUES(NULL, 4);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (c1 FLOAT NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(NULL, 1);
|
||||
INSERT INTO t1 VALUES(NULL, 2);
|
||||
SELECT * FROM t1;
|
||||
ALTER TABLE t1 CHANGE c1 c1 SERIAL;
|
||||
SELECT * FROM t1;
|
||||
INSERT INTO t1 VALUES(NULL, 3);
|
||||
INSERT INTO t1 VALUES(NULL, 4);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug# 42714: AUTOINC column calculated next value not greater than highest
|
||||
# value stored in table.
|
||||
#
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=5;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
CREATE TABLE t1 (
|
||||
a INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
b INT(10) UNSIGNED NOT NULL,
|
||||
c ENUM('FALSE','TRUE') DEFAULT NULL,
|
||||
PRIMARY KEY (a)) ENGINE = InnoDB;
|
||||
CREATE TABLE t2 (
|
||||
m INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
n INT(10) UNSIGNED NOT NULL,
|
||||
o enum('FALSE','TRUE') DEFAULT NULL,
|
||||
PRIMARY KEY (m)) ENGINE = InnoDB;
|
||||
INSERT INTO t2 (n,o) VALUES
|
||||
(1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'),
|
||||
(3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false');
|
||||
SHOW CREATE TABLE t2;
|
||||
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
|
||||
SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
||||
SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
||||
SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
||||
SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
#
|
||||
# 43203: Overflow from auto incrementing causes server segv
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
CREATE TABLE t1(
|
||||
c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT
|
||||
PRIMARY KEY) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
|
||||
CREATE TABLE t2(
|
||||
c1 TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT
|
||||
PRIMARY KEY) ENGINE=InnoDB;
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
INSERT INTO t2 SELECT c1 FROM t1;
|
||||
-- error ER_DUP_ENTRY,1467
|
||||
INSERT INTO t2 SELECT NULL FROM t1;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
||||
# If the user has specified negative values for an AUTOINC column then
|
||||
# InnoDB should ignore those values when setting the table's max value.
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
# TINYINT
|
||||
CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (-1, 'innodb');
|
||||
INSERT INTO t1 VALUES (-127, 'innodb');
|
||||
INSERT INTO t1 VALUES (NULL, NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (-1, 'innodb');
|
||||
INSERT INTO t1 VALUES (-127, 'innodb');
|
||||
INSERT INTO t1 VALUES (NULL, NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# SMALLINT
|
||||
#
|
||||
CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (-1, 'innodb');
|
||||
INSERT INTO t1 VALUES (-32767, 'innodb');
|
||||
INSERT INTO t1 VALUES (NULL, NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (-1, 'innodb');
|
||||
INSERT INTO t1 VALUES (-32757, 'innodb');
|
||||
INSERT INTO t1 VALUES (NULL, NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MEDIUMINT
|
||||
#
|
||||
CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (-1, 'innodb');
|
||||
INSERT INTO t1 VALUES (-8388607, 'innodb');
|
||||
INSERT INTO t1 VALUES (NULL, NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (-1, 'innodb');
|
||||
INSERT INTO t1 VALUES (-8388607, 'innodb');
|
||||
INSERT INTO t1 VALUES (NULL, NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# INT
|
||||
#
|
||||
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (-1, 'innodb');
|
||||
INSERT INTO t1 VALUES (-2147483647, 'innodb');
|
||||
INSERT INTO t1 VALUES (NULL, NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (-1, 'innodb');
|
||||
INSERT INTO t1 VALUES (-2147483647, 'innodb');
|
||||
INSERT INTO t1 VALUES (NULL, NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BIGINT
|
||||
#
|
||||
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (-1, 'innodb');
|
||||
INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
|
||||
INSERT INTO t1 VALUES (NULL, NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (-1, 'innodb');
|
||||
INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
|
||||
INSERT INTO t1 VALUES (NULL, NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End negative number check
|
||||
|
||||
##
|
||||
# 47125: auto_increment start value is ignored if an index is created
|
||||
# and engine=innodb
|
||||
#
|
||||
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
|
||||
CREATE INDEX i1 on t1(c2);
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (c2) values (0);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
##
|
||||
# 49032: Use the correct function to read the AUTOINC column value
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1(C1 DOUBLE AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
|
||||
# Restart the server
|
||||
-- source include/restart_mysqld.inc
|
||||
INSERT INTO t1(C2) VALUES ('innodb');
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(C1 FLOAT AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
|
||||
# Restart the server
|
||||
-- source include/restart_mysqld.inc
|
||||
INSERT INTO t1(C2) VALUES ('innodb');
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
##
|
||||
# 47720: REPLACE INTO Autoincrement column with negative values
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (c1 INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
|
||||
INSERT INTO t1 SET c1 = 1;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 SET c1 = 2;
|
||||
INSERT INTO t1 SET c1 = -1;
|
||||
SELECT * FROM t1;
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
INSERT INTO t1 SET c1 = -1;
|
||||
SHOW CREATE TABLE t1;
|
||||
REPLACE INTO t1 VALUES (-1);
|
||||
SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
##
|
||||
# 49497: Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL);
|
||||
SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL);
|
||||
SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL);
|
||||
INSERT INTO t1 VALUES (4), (5), (6), (NULL);
|
||||
SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5);
|
||||
SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL);
|
||||
SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
|
@ -1 +0,0 @@
|
|||
--loose-innodb_lock_wait_timeout=2
|
|
@ -1,35 +0,0 @@
|
|||
drop table if exists t1;
|
||||
set session transaction isolation level read committed;
|
||||
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
|
||||
create table t2 like t1;
|
||||
insert into t2 values (1),(2),(3),(4),(5),(6),(7);
|
||||
set autocommit=0;
|
||||
begin;
|
||||
replace into t1 select * from t2;
|
||||
set session transaction isolation level read committed;
|
||||
set autocommit=0;
|
||||
delete from t2 where a=5;
|
||||
commit;
|
||||
delete from t2;
|
||||
commit;
|
||||
commit;
|
||||
begin;
|
||||
insert into t1 select * from t2;
|
||||
set session transaction isolation level read committed;
|
||||
set autocommit=0;
|
||||
delete from t2 where a=5;
|
||||
commit;
|
||||
delete from t2;
|
||||
commit;
|
||||
commit;
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
drop table t1;
|
||||
drop table t2;
|
|
@ -1,58 +0,0 @@
|
|||
-- source include/not_embedded.inc
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
# REPLACE INTO ... SELECT and INSERT INTO ... SELECT should do
|
||||
# a consistent read of the source table.
|
||||
|
||||
connect (a,localhost,root,,);
|
||||
connect (b,localhost,root,,);
|
||||
connection a;
|
||||
set session transaction isolation level read committed;
|
||||
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
|
||||
create table t2 like t1;
|
||||
insert into t2 values (1),(2),(3),(4),(5),(6),(7);
|
||||
set autocommit=0;
|
||||
|
||||
# REPLACE INTO ... SELECT case
|
||||
begin;
|
||||
# this should not result in any locks on t2.
|
||||
replace into t1 select * from t2;
|
||||
|
||||
connection b;
|
||||
set session transaction isolation level read committed;
|
||||
set autocommit=0;
|
||||
# should not cause a lock wait.
|
||||
delete from t2 where a=5;
|
||||
commit;
|
||||
delete from t2;
|
||||
commit;
|
||||
connection a;
|
||||
commit;
|
||||
|
||||
# INSERT INTO ... SELECT case
|
||||
begin;
|
||||
# this should not result in any locks on t2.
|
||||
insert into t1 select * from t2;
|
||||
|
||||
connection b;
|
||||
set session transaction isolation level read committed;
|
||||
set autocommit=0;
|
||||
# should not cause a lock wait.
|
||||
delete from t2 where a=5;
|
||||
commit;
|
||||
delete from t2;
|
||||
commit;
|
||||
connection a;
|
||||
commit;
|
||||
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
|
||||
connection default;
|
||||
disconnect a;
|
||||
disconnect b;
|
|
@ -1,57 +0,0 @@
|
|||
set global innodb_table_locks=1;
|
||||
select @@innodb_table_locks;
|
||||
@@innodb_table_locks
|
||||
1
|
||||
drop table if exists t1;
|
||||
set @@innodb_table_locks=1;
|
||||
create table t1 (id integer, x integer) engine=INNODB;
|
||||
insert into t1 values(0, 0);
|
||||
set autocommit=0;
|
||||
SELECT * from t1 where id = 0 FOR UPDATE;
|
||||
id x
|
||||
0 0
|
||||
set autocommit=0;
|
||||
lock table t1 write;
|
||||
update t1 set x=1 where id = 0;
|
||||
select * from t1;
|
||||
id x
|
||||
0 1
|
||||
commit;
|
||||
update t1 set x=2 where id = 0;
|
||||
commit;
|
||||
unlock tables;
|
||||
select * from t1;
|
||||
id x
|
||||
0 2
|
||||
commit;
|
||||
drop table t1;
|
||||
set @@innodb_table_locks=0;
|
||||
create table t1 (id integer primary key, x integer) engine=INNODB;
|
||||
insert into t1 values(0, 0),(1,1),(2,2);
|
||||
commit;
|
||||
SELECT * from t1 where id = 0 FOR UPDATE;
|
||||
id x
|
||||
0 0
|
||||
set autocommit=0;
|
||||
set @@innodb_table_locks=0;
|
||||
lock table t1 write;
|
||||
update t1 set x=10 where id = 2;
|
||||
SELECT * from t1 where id = 2;
|
||||
id x
|
||||
2 2
|
||||
UPDATE t1 set x=3 where id = 2;
|
||||
commit;
|
||||
SELECT * from t1;
|
||||
id x
|
||||
0 0
|
||||
1 1
|
||||
2 3
|
||||
commit;
|
||||
unlock tables;
|
||||
commit;
|
||||
select * from t1;
|
||||
id x
|
||||
0 0
|
||||
1 1
|
||||
2 10
|
||||
drop table t1;
|
|
@ -1,102 +0,0 @@
|
|||
-- source include/have_innodb.inc
|
||||
|
||||
#
|
||||
# Check and select innodb lock type
|
||||
#
|
||||
|
||||
set global innodb_table_locks=1;
|
||||
|
||||
select @@innodb_table_locks;
|
||||
|
||||
#
|
||||
# Testing of explicit table locks with enforced table locks
|
||||
#
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
connect (con2,localhost,root,,);
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Testing of explicit table locks with enforced table locks
|
||||
#
|
||||
|
||||
set @@innodb_table_locks=1;
|
||||
|
||||
connection con1;
|
||||
create table t1 (id integer, x integer) engine=INNODB;
|
||||
insert into t1 values(0, 0);
|
||||
set autocommit=0;
|
||||
SELECT * from t1 where id = 0 FOR UPDATE;
|
||||
|
||||
connection con2;
|
||||
set autocommit=0;
|
||||
|
||||
# The following statement should hang because con1 is locking the page
|
||||
--send
|
||||
lock table t1 write;
|
||||
--sleep 2
|
||||
|
||||
connection con1;
|
||||
update t1 set x=1 where id = 0;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
connection con2;
|
||||
reap;
|
||||
update t1 set x=2 where id = 0;
|
||||
commit;
|
||||
unlock tables;
|
||||
|
||||
connection con1;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Try with old lock method (where LOCK TABLE is ignored by InnoDB)
|
||||
#
|
||||
|
||||
set @@innodb_table_locks=0;
|
||||
|
||||
create table t1 (id integer primary key, x integer) engine=INNODB;
|
||||
insert into t1 values(0, 0),(1,1),(2,2);
|
||||
commit;
|
||||
SELECT * from t1 where id = 0 FOR UPDATE;
|
||||
|
||||
connection con2;
|
||||
set autocommit=0;
|
||||
set @@innodb_table_locks=0;
|
||||
|
||||
# The following statement should work becase innodb doesn't check table locks
|
||||
lock table t1 write;
|
||||
|
||||
connection con1;
|
||||
|
||||
# This will be locked by MySQL
|
||||
--send
|
||||
update t1 set x=10 where id = 2;
|
||||
--sleep 2
|
||||
|
||||
connection con2;
|
||||
|
||||
# Note that we will get a deadlock if we try to select any rows marked
|
||||
# for update by con1 !
|
||||
|
||||
SELECT * from t1 where id = 2;
|
||||
UPDATE t1 set x=3 where id = 2;
|
||||
commit;
|
||||
SELECT * from t1;
|
||||
commit;
|
||||
unlock tables;
|
||||
|
||||
connection con1;
|
||||
reap;
|
||||
commit;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
|
@ -1 +0,0 @@
|
|||
--binlog_cache_size=32768 --loose_innodb_lock_wait_timeout=1
|
|
@ -1,13 +0,0 @@
|
|||
drop table if exists t1;
|
||||
create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb;
|
||||
select * from t1;
|
||||
c1 c2 stamp
|
||||
replace delayed into t1 (c1, c2) values ( "text1","11");
|
||||
ERROR HY000: DELAYED option not supported for table 't1'
|
||||
select * from t1;
|
||||
c1 c2 stamp
|
||||
replace delayed into t1 (c1, c2) values ( "text1","12");
|
||||
ERROR HY000: DELAYED option not supported for table 't1'
|
||||
select * from t1;
|
||||
c1 c2 stamp
|
||||
drop table t1;
|
|
@ -1,22 +0,0 @@
|
|||
-- source include/have_innodb.inc
|
||||
# embedded server ignores 'delayed', so skip this
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Bug #1078
|
||||
#
|
||||
create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb;
|
||||
select * from t1;
|
||||
--error ER_DELAYED_NOT_SUPPORTED
|
||||
replace delayed into t1 (c1, c2) values ( "text1","11");
|
||||
select * from t1;
|
||||
--error ER_DELAYED_NOT_SUPPORTED
|
||||
replace delayed into t1 (c1, c2) values ( "text1","12");
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
|
@ -1 +0,0 @@
|
|||
--loose-innodb_lock_wait_timeout=2
|
|
@ -1,47 +0,0 @@
|
|||
drop table if exists t1;
|
||||
set binlog_format=mixed;
|
||||
set session transaction isolation level repeatable read;
|
||||
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
|
||||
set autocommit=0;
|
||||
select * from t1 where a=3 lock in share mode;
|
||||
a
|
||||
3
|
||||
set binlog_format=mixed;
|
||||
set session transaction isolation level repeatable read;
|
||||
set autocommit=0;
|
||||
update t1 set a=10 where a=5;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
commit;
|
||||
set session transaction isolation level read committed;
|
||||
update t1 set a=10 where a=5;
|
||||
select * from t1 where a=2 for update;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
select * from t1 where a=2 limit 1 for update;
|
||||
a
|
||||
2
|
||||
update t1 set a=11 where a=6;
|
||||
update t1 set a=12 where a=2;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
update t1 set a=13 where a=1;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
commit;
|
||||
update t1 set a=14 where a=1;
|
||||
commit;
|
||||
select * from t1;
|
||||
a
|
||||
14
|
||||
2
|
||||
3
|
||||
4
|
||||
10
|
||||
11
|
||||
7
|
||||
drop table t1;
|
||||
create table t1 (a int, b int) engine=myisam;
|
||||
create table t2 (c int, d int, key (c)) engine=innodb;
|
||||
insert into t1 values (1,1);
|
||||
insert into t2 values (1,2);
|
||||
set session transaction isolation level read committed;
|
||||
delete from t1 using t1 join t2 on t1.a = t2.c where t2.d in (1);
|
||||
drop table t1, t2;
|
|
@ -1,68 +0,0 @@
|
|||
-- source include/not_embedded.inc
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
# basic tests of semi-consistent reads
|
||||
|
||||
connect (a,localhost,root,,);
|
||||
connect (b,localhost,root,,);
|
||||
connection a;
|
||||
set binlog_format=mixed;
|
||||
set session transaction isolation level repeatable read;
|
||||
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
|
||||
set autocommit=0;
|
||||
# this should lock the entire table
|
||||
select * from t1 where a=3 lock in share mode;
|
||||
connection b;
|
||||
set binlog_format=mixed;
|
||||
set session transaction isolation level repeatable read;
|
||||
set autocommit=0;
|
||||
-- error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set a=10 where a=5;
|
||||
connection a;
|
||||
commit;
|
||||
connection b;
|
||||
# perform a semi-consisent read (and unlock non-matching rows)
|
||||
set session transaction isolation level read committed;
|
||||
update t1 set a=10 where a=5;
|
||||
connection a;
|
||||
-- error ER_LOCK_WAIT_TIMEOUT
|
||||
select * from t1 where a=2 for update;
|
||||
# this should lock the records (1),(2)
|
||||
select * from t1 where a=2 limit 1 for update;
|
||||
connection b;
|
||||
# semi-consistent read will skip non-matching locked rows a=1, a=2
|
||||
update t1 set a=11 where a=6;
|
||||
-- error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set a=12 where a=2;
|
||||
-- error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set a=13 where a=1;
|
||||
connection a;
|
||||
commit;
|
||||
connection b;
|
||||
update t1 set a=14 where a=1;
|
||||
commit;
|
||||
connection a;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
connection default;
|
||||
disconnect a;
|
||||
disconnect b;
|
||||
|
||||
# Bug 39320
|
||||
create table t1 (a int, b int) engine=myisam;
|
||||
create table t2 (c int, d int, key (c)) engine=innodb;
|
||||
insert into t1 values (1,1);
|
||||
insert into t2 values (1,2);
|
||||
connect (a,localhost,root,,);
|
||||
connection a;
|
||||
set session transaction isolation level read committed;
|
||||
delete from t1 using t1 join t2 on t1.a = t2.c where t2.d in (1);
|
||||
connection default;
|
||||
disconnect a;
|
||||
drop table t1, t2;
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,55 +0,0 @@
|
|||
#
|
||||
# Bug#21704: Renaming column does not update FK definition.
|
||||
#
|
||||
|
||||
# Test that it's not possible to rename columns participating in a
|
||||
# foreign key (either in the referencing or referenced table).
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ROW_FORMAT=COMPACT ENGINE=INNODB;
|
||||
CREATE TABLE t2 (a INT PRIMARY KEY, b INT,
|
||||
CONSTRAINT fk1 FOREIGN KEY (a) REFERENCES t1(a))
|
||||
ROW_FORMAT=COMPACT ENGINE=INNODB;
|
||||
CREATE TABLE t3 (a INT PRIMARY KEY, b INT, KEY(b), C INT,
|
||||
CONSTRAINT fk2 FOREIGN KEY (b) REFERENCES t3 (a))
|
||||
ROW_FORMAT=COMPACT ENGINE=INNODB;
|
||||
INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
|
||||
INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
|
||||
INSERT INTO t3 VALUES (1,1,1),(2,2,2),(3,3,3);
|
||||
|
||||
# Test renaming the column in the referenced table.
|
||||
|
||||
ALTER TABLE t1 CHANGE a c INT;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150)
|
||||
# Ensure that online column rename works.
|
||||
ALTER TABLE t1 CHANGE b c INT;
|
||||
affected rows: 3
|
||||
info: Records: 3 Duplicates: 0 Warnings: 0
|
||||
|
||||
# Test renaming the column in the referencing table
|
||||
|
||||
ALTER TABLE t2 CHANGE a c INT;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
|
||||
# Ensure that online column rename works.
|
||||
ALTER TABLE t2 CHANGE b c INT;
|
||||
affected rows: 3
|
||||
info: Records: 3 Duplicates: 0 Warnings: 0
|
||||
|
||||
# Test with self-referential constraints
|
||||
|
||||
ALTER TABLE t3 CHANGE a d INT;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150)
|
||||
ALTER TABLE t3 CHANGE b d INT;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150)
|
||||
# Ensure that online column rename works.
|
||||
ALTER TABLE t3 CHANGE c d INT;
|
||||
affected rows: 3
|
||||
info: Records: 3 Duplicates: 0 Warnings: 0
|
||||
|
||||
# Cleanup.
|
||||
|
||||
DROP TABLE t3;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
|
@ -1,96 +0,0 @@
|
|||
-- source include/have_innodb.inc
|
||||
|
||||
--echo #
|
||||
--echo # Bug#21704: Renaming column does not update FK definition.
|
||||
--echo #
|
||||
|
||||
--echo
|
||||
--echo # Test that it's not possible to rename columns participating in a
|
||||
--echo # foreign key (either in the referencing or referenced table).
|
||||
--echo
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ROW_FORMAT=COMPACT ENGINE=INNODB;
|
||||
|
||||
CREATE TABLE t2 (a INT PRIMARY KEY, b INT,
|
||||
CONSTRAINT fk1 FOREIGN KEY (a) REFERENCES t1(a))
|
||||
ROW_FORMAT=COMPACT ENGINE=INNODB;
|
||||
|
||||
CREATE TABLE t3 (a INT PRIMARY KEY, b INT, KEY(b), C INT,
|
||||
CONSTRAINT fk2 FOREIGN KEY (b) REFERENCES t3 (a))
|
||||
ROW_FORMAT=COMPACT ENGINE=INNODB;
|
||||
|
||||
INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
|
||||
INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
|
||||
INSERT INTO t3 VALUES (1,1,1),(2,2,2),(3,3,3);
|
||||
|
||||
--echo
|
||||
--echo # Test renaming the column in the referenced table.
|
||||
--echo
|
||||
|
||||
# mysqltest first does replace_regex, then replace_result
|
||||
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
|
||||
# Embedded server doesn't chdir to data directory
|
||||
--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
|
||||
--error ER_ERROR_ON_RENAME
|
||||
ALTER TABLE t1 CHANGE a c INT;
|
||||
|
||||
--echo # Ensure that online column rename works.
|
||||
|
||||
--enable_info
|
||||
ALTER TABLE t1 CHANGE b c INT;
|
||||
--disable_info
|
||||
|
||||
--echo
|
||||
--echo # Test renaming the column in the referencing table
|
||||
--echo
|
||||
|
||||
# mysqltest first does replace_regex, then replace_result
|
||||
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
|
||||
# Embedded server doesn't chdir to data directory
|
||||
--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
|
||||
--error ER_ERROR_ON_RENAME
|
||||
ALTER TABLE t2 CHANGE a c INT;
|
||||
|
||||
--echo # Ensure that online column rename works.
|
||||
|
||||
--enable_info
|
||||
ALTER TABLE t2 CHANGE b c INT;
|
||||
--disable_info
|
||||
|
||||
--echo
|
||||
--echo # Test with self-referential constraints
|
||||
--echo
|
||||
|
||||
# mysqltest first does replace_regex, then replace_result
|
||||
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
|
||||
# Embedded server doesn't chdir to data directory
|
||||
--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
|
||||
--error ER_ERROR_ON_RENAME
|
||||
ALTER TABLE t3 CHANGE a d INT;
|
||||
|
||||
# mysqltest first does replace_regex, then replace_result
|
||||
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
|
||||
# Embedded server doesn't chdir to data directory
|
||||
--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
|
||||
--error ER_ERROR_ON_RENAME
|
||||
ALTER TABLE t3 CHANGE b d INT;
|
||||
|
||||
--echo # Ensure that online column rename works.
|
||||
|
||||
--enable_info
|
||||
ALTER TABLE t3 CHANGE c d INT;
|
||||
--disable_info
|
||||
|
||||
--echo
|
||||
--echo # Cleanup.
|
||||
--echo
|
||||
|
||||
DROP TABLE t3;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
|
@ -1 +0,0 @@
|
|||
SET storage_engine=InnoDB;
|
|
@ -1,50 +0,0 @@
|
|||
#
|
||||
# Make sure http://bugs.mysql.com/34053 remains fixed.
|
||||
#
|
||||
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
SET storage_engine=InnoDB;
|
||||
|
||||
# we do not really care about what gets printed, we are only
|
||||
# interested in getting success or failure according to our
|
||||
# expectations
|
||||
-- disable_query_log
|
||||
-- disable_result_log
|
||||
|
||||
GRANT USAGE ON *.* TO 'shane'@'localhost' IDENTIFIED BY '12345';
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
-- connect (con1,localhost,shane,12345,)
|
||||
|
||||
-- connection con1
|
||||
-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB;
|
||||
-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
CREATE TABLE innodb_mem_validate (a INT) ENGINE=INNODB;
|
||||
CREATE TABLE innodb_monitorx (a INT) ENGINE=INNODB;
|
||||
DROP TABLE innodb_monitorx;
|
||||
CREATE TABLE innodb_monito (a INT) ENGINE=INNODB;
|
||||
DROP TABLE innodb_monito;
|
||||
CREATE TABLE xinnodb_monitor (a INT) ENGINE=INNODB;
|
||||
DROP TABLE xinnodb_monitor;
|
||||
CREATE TABLE nnodb_monitor (a INT) ENGINE=INNODB;
|
||||
DROP TABLE nnodb_monitor;
|
||||
|
||||
-- connection default
|
||||
CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB;
|
||||
CREATE TABLE innodb_mem_validate (a INT) ENGINE=INNODB;
|
||||
|
||||
-- connection con1
|
||||
-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
DROP TABLE innodb_monitor;
|
||||
-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
DROP TABLE innodb_mem_validate;
|
||||
|
||||
-- connection default
|
||||
DROP TABLE innodb_monitor;
|
||||
DROP TABLE innodb_mem_validate;
|
||||
DROP USER 'shane'@'localhost';
|
||||
|
||||
-- disconnect con1
|
|
@ -1,4 +0,0 @@
|
|||
f4 f8
|
||||
xxx zzz
|
||||
f4 f8
|
||||
xxx zzz
|
|
@ -1,34 +0,0 @@
|
|||
#
|
||||
# Bug#34300 Tinyblob & tinytext fields currupted after export/import and alter in 5.1
|
||||
# http://bugs.mysql.com/34300
|
||||
#
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
-- disable_query_log
|
||||
-- disable_result_log
|
||||
|
||||
# set packet size and reconnect
|
||||
let $max_packet=`select @@global.max_allowed_packet`;
|
||||
SET @@global.max_allowed_packet=16777216;
|
||||
--connect (newconn, localhost, root,,)
|
||||
|
||||
DROP TABLE IF EXISTS bug34300;
|
||||
CREATE TABLE bug34300 (
|
||||
f4 TINYTEXT,
|
||||
f6 MEDIUMTEXT,
|
||||
f8 TINYBLOB
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO bug34300 VALUES ('xxx', repeat('a', 8459264), 'zzz');
|
||||
|
||||
-- enable_result_log
|
||||
|
||||
SELECT f4, f8 FROM bug34300;
|
||||
|
||||
ALTER TABLE bug34300 ADD COLUMN (f10 INT);
|
||||
|
||||
SELECT f4, f8 FROM bug34300;
|
||||
|
||||
DROP TABLE bug34300;
|
||||
EVAL SET @@global.max_allowed_packet=$max_packet;
|
|
@ -1 +0,0 @@
|
|||
SET storage_engine=InnoDB;
|
|
@ -1,16 +0,0 @@
|
|||
#
|
||||
# Bug#35220 ALTER TABLE too picky on reserved word "foreign"
|
||||
# http://bugs.mysql.com/35220
|
||||
#
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
SET storage_engine=InnoDB;
|
||||
|
||||
# we care only that the following SQL commands do not produce errors
|
||||
-- disable_query_log
|
||||
-- disable_result_log
|
||||
|
||||
CREATE TABLE bug35220 (foreign_col INT, dummy_cant_delete_all_columns INT);
|
||||
ALTER TABLE bug35220 DROP foreign_col;
|
||||
DROP TABLE bug35220;
|
|
@ -1,11 +0,0 @@
|
|||
SET storage_engine=InnoDB;
|
||||
INSERT INTO bug38231 VALUES (1), (10), (300);
|
||||
SET autocommit=0;
|
||||
SELECT * FROM bug38231 FOR UPDATE;
|
||||
a
|
||||
1
|
||||
10
|
||||
300
|
||||
TRUNCATE TABLE bug38231;
|
||||
COMMIT;
|
||||
DROP TABLE bug38231;
|
|
@ -1,112 +0,0 @@
|
|||
#
|
||||
# Bug#38231 Innodb crash in lock_reset_all_on_table() on TRUNCATE + LOCK / UNLOCK
|
||||
# http://bugs.mysql.com/38231
|
||||
#
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
SET storage_engine=InnoDB;
|
||||
|
||||
# we care only that the following SQL commands do not crash the server
|
||||
-- disable_query_log
|
||||
-- disable_result_log
|
||||
|
||||
DROP TABLE IF EXISTS bug38231;
|
||||
CREATE TABLE bug38231 (a INT);
|
||||
|
||||
-- connect (con1,localhost,root,,)
|
||||
-- connect (con2,localhost,root,,)
|
||||
-- connect (con3,localhost,root,,)
|
||||
|
||||
-- connection con1
|
||||
SET autocommit=0;
|
||||
LOCK TABLE bug38231 WRITE;
|
||||
|
||||
-- connection con2
|
||||
SET autocommit=0;
|
||||
-- send
|
||||
LOCK TABLE bug38231 WRITE;
|
||||
|
||||
# When con1 does UNLOCK below this will release either con2 or con3 which are
|
||||
# both waiting on LOCK. At the end we must first --reap and UNLOCK the
|
||||
# connection that has been released, otherwise it will wait forever. We assume
|
||||
# that the released connection will be the first one that has gained the LOCK,
|
||||
# thus we force the order here - con2 does LOCK first, then con3. In other
|
||||
# words we wait for LOCK from con2 above to be exected before doing LOCK in
|
||||
# con3.
|
||||
-- connection con1
|
||||
let $wait_condition =
|
||||
SELECT COUNT(*) = 1 FROM information_schema.processlist
|
||||
WHERE info = 'LOCK TABLE bug38231 WRITE';
|
||||
-- source include/wait_condition.inc
|
||||
# the above enables query log, re-disable it
|
||||
-- disable_query_log
|
||||
|
||||
-- connection con3
|
||||
SET autocommit=0;
|
||||
-- send
|
||||
LOCK TABLE bug38231 WRITE;
|
||||
|
||||
-- connection default
|
||||
-- send
|
||||
TRUNCATE TABLE bug38231;
|
||||
|
||||
-- connection con1
|
||||
# Wait for TRUNCATE and the other two LOCKs to be executed; without this,
|
||||
# sometimes UNLOCK executes before them. We assume there are no other
|
||||
# sessions executing at the same time with the same SQL commands.
|
||||
let $wait_condition =
|
||||
SELECT COUNT(*) = 1 FROM information_schema.processlist
|
||||
WHERE info = 'TRUNCATE TABLE bug38231';
|
||||
-- source include/wait_condition.inc
|
||||
let $wait_condition =
|
||||
SELECT COUNT(*) = 2 FROM information_schema.processlist
|
||||
WHERE info = 'LOCK TABLE bug38231 WRITE';
|
||||
-- source include/wait_condition.inc
|
||||
# the above enables query log, re-disable it
|
||||
-- disable_query_log
|
||||
|
||||
# this crashes the server if the bug is present
|
||||
UNLOCK TABLES;
|
||||
|
||||
# clean up
|
||||
|
||||
-- connection con2
|
||||
-- reap
|
||||
UNLOCK TABLES;
|
||||
|
||||
-- connection con3
|
||||
-- reap
|
||||
UNLOCK TABLES;
|
||||
|
||||
-- connection default
|
||||
-- reap
|
||||
|
||||
-- disconnect con1
|
||||
-- disconnect con2
|
||||
-- disconnect con3
|
||||
|
||||
# test that TRUNCATE works with with row-level locks
|
||||
|
||||
-- enable_query_log
|
||||
-- enable_result_log
|
||||
|
||||
INSERT INTO bug38231 VALUES (1), (10), (300);
|
||||
|
||||
-- connect (con4,localhost,root,,)
|
||||
|
||||
-- connection con4
|
||||
SET autocommit=0;
|
||||
SELECT * FROM bug38231 FOR UPDATE;
|
||||
|
||||
-- connection default
|
||||
TRUNCATE TABLE bug38231;
|
||||
|
||||
-- connection con4
|
||||
COMMIT;
|
||||
|
||||
-- connection default
|
||||
|
||||
-- disconnect con4
|
||||
|
||||
DROP TABLE bug38231;
|
|
@ -1 +0,0 @@
|
|||
--innodb-file-per-table=1
|
|
@ -1 +0,0 @@
|
|||
SET storage_engine=InnoDB;
|
|
@ -1,51 +0,0 @@
|
|||
#
|
||||
# Bug#39438 Testcase for Bug#39436 crashes on 5.1 in fil_space_get_latch
|
||||
# http://bugs.mysql.com/39438
|
||||
#
|
||||
# This test must be run with innodb_file_per_table=1 because the crash
|
||||
# only occurs if that option is turned on and DISCARD TABLESPACE only
|
||||
# works with innodb_file_per_table.
|
||||
#
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
SET storage_engine=InnoDB;
|
||||
|
||||
# we care only that the following SQL commands do not crash the server
|
||||
-- disable_query_log
|
||||
-- disable_result_log
|
||||
|
||||
DROP TABLE IF EXISTS bug39438;
|
||||
|
||||
CREATE TABLE bug39438 (id INT) ENGINE=INNODB;
|
||||
|
||||
# remove: XXX Uncomment the following ALTER and remove those lines after
|
||||
# remove: applying the patch.
|
||||
# remove: Obviously this test is useless without this ALTER command,
|
||||
# remove: but it causes warnings to be printed by mysqld and the whole
|
||||
# remove: mysql-test suite fails at the end (returns non-zero). Please
|
||||
# remove: apply this patch to the mysql source tree, remove those lines
|
||||
# remove: and uncomment the following ALTER. We do not care about the
|
||||
# remove: warnings, this test is to ensure mysqld does not crash.
|
||||
# remove: === modified file 'mysql-test/lib/mtr_report.pl'
|
||||
# remove: --- mysql-test/lib/mtr_report.pl 2008-08-12 10:26:23 +0000
|
||||
# remove: +++ mysql-test/lib/mtr_report.pl 2008-10-01 11:57:41 +0000
|
||||
# remove: @@ -412,7 +412,10 @@
|
||||
# remove:
|
||||
# remove: # When trying to set lower_case_table_names = 2
|
||||
# remove: # on a case sensitive file system. Bug#37402.
|
||||
# remove: - /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./
|
||||
# remove: + /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./ or
|
||||
# remove: +
|
||||
# remove: + # this test is expected to print warnings
|
||||
# remove: + ($testname eq 'main.innodb_bug39438')
|
||||
# remove: )
|
||||
# remove: {
|
||||
# remove: next; # Skip these lines
|
||||
# remove:
|
||||
#ALTER TABLE bug39438 DISCARD TABLESPACE;
|
||||
|
||||
# this crashes the server if the bug is present
|
||||
SHOW TABLE STATUS;
|
||||
|
||||
DROP TABLE bug39438;
|
|
@ -1,9 +0,0 @@
|
|||
create table bug40565(value decimal(4,2)) engine=innodb;
|
||||
insert into bug40565 values (1), (null);
|
||||
update bug40565 set value=NULL;
|
||||
affected rows: 1
|
||||
info: Rows matched: 2 Changed: 1 Warnings: 0
|
||||
update bug40565 set value=NULL;
|
||||
affected rows: 0
|
||||
info: Rows matched: 2 Changed: 0 Warnings: 0
|
||||
drop table bug40565;
|
|
@ -1,10 +0,0 @@
|
|||
# Bug #40565 Update Query Results in "1 Row Affected" But Should Be "Zero Rows"
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
create table bug40565(value decimal(4,2)) engine=innodb;
|
||||
insert into bug40565 values (1), (null);
|
||||
--enable_info
|
||||
update bug40565 set value=NULL;
|
||||
update bug40565 set value=NULL;
|
||||
--disable_info
|
||||
drop table bug40565;
|
|
@ -1 +0,0 @@
|
|||
--loose_innodb_commit_concurrency=1
|
|
@ -1,26 +0,0 @@
|
|||
set global innodb_commit_concurrency=0;
|
||||
ERROR HY000: Incorrect arguments to SET
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
1
|
||||
set global innodb_commit_concurrency=1;
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
1
|
||||
set global innodb_commit_concurrency=42;
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
42
|
||||
set global innodb_commit_concurrency=DEFAULT;
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
1
|
||||
set global innodb_commit_concurrency=0;
|
||||
ERROR HY000: Incorrect arguments to SET
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
1
|
||||
set global innodb_commit_concurrency=1;
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
1
|
|
@ -1,21 +0,0 @@
|
|||
#
|
||||
# Bug#42101 Race condition in innodb_commit_concurrency
|
||||
# http://bugs.mysql.com/42101
|
||||
#
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
set global innodb_commit_concurrency=0;
|
||||
select @@innodb_commit_concurrency;
|
||||
set global innodb_commit_concurrency=1;
|
||||
select @@innodb_commit_concurrency;
|
||||
set global innodb_commit_concurrency=42;
|
||||
select @@innodb_commit_concurrency;
|
||||
set global innodb_commit_concurrency=DEFAULT;
|
||||
select @@innodb_commit_concurrency;
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
set global innodb_commit_concurrency=0;
|
||||
select @@innodb_commit_concurrency;
|
||||
set global innodb_commit_concurrency=1;
|
||||
select @@innodb_commit_concurrency;
|
|
@ -1,22 +0,0 @@
|
|||
set global innodb_commit_concurrency=0;
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
0
|
||||
set global innodb_commit_concurrency=1;
|
||||
ERROR HY000: Incorrect arguments to SET
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
0
|
||||
set global innodb_commit_concurrency=42;
|
||||
ERROR HY000: Incorrect arguments to SET
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
0
|
||||
set global innodb_commit_concurrency=0;
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
0
|
||||
set global innodb_commit_concurrency=DEFAULT;
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
0
|
|
@ -1,19 +0,0 @@
|
|||
#
|
||||
# Bug#42101 Race condition in innodb_commit_concurrency
|
||||
# http://bugs.mysql.com/42101
|
||||
#
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
set global innodb_commit_concurrency=0;
|
||||
select @@innodb_commit_concurrency;
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
set global innodb_commit_concurrency=1;
|
||||
select @@innodb_commit_concurrency;
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
set global innodb_commit_concurrency=42;
|
||||
select @@innodb_commit_concurrency;
|
||||
set global innodb_commit_concurrency=0;
|
||||
select @@innodb_commit_concurrency;
|
||||
set global innodb_commit_concurrency=DEFAULT;
|
||||
select @@innodb_commit_concurrency;
|
|
@ -1,6 +0,0 @@
|
|||
create table bug44369 (DB_ROW_ID int) engine=innodb;
|
||||
ERROR 42000: Incorrect column name 'DB_ROW_ID'
|
||||
create table bug44369 (db_row_id int) engine=innodb;
|
||||
ERROR 42000: Incorrect column name 'db_row_id'
|
||||
create table bug44369 (db_TRX_Id int) engine=innodb;
|
||||
ERROR 42000: Incorrect column name 'db_TRX_Id'
|
|
@ -1,17 +0,0 @@
|
|||
# This is the test for bug 44369. We should
|
||||
# block table creation with columns match
|
||||
# some innodb internal reserved key words,
|
||||
# both case sensitively and insensitely.
|
||||
|
||||
--source include/have_innodb.inc
|
||||
|
||||
# This create table operation should fail.
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
create table bug44369 (DB_ROW_ID int) engine=innodb;
|
||||
|
||||
# This create should fail as well
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
create table bug44369 (db_row_id int) engine=innodb;
|
||||
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
create table bug44369 (db_TRX_Id int) engine=innodb;
|
|
@ -1,8 +0,0 @@
|
|||
CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
|
||||
ALTER TABLE bug44571 CHANGE foo bar INT;
|
||||
ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
|
||||
ERROR 42000: Key column 'foo' doesn't exist in table
|
||||
ALTER TABLE bug44571 ADD INDEX bug44571c (bar);
|
||||
DROP INDEX bug44571c ON bug44571;
|
||||
CREATE INDEX bug44571c ON bug44571 (bar);
|
||||
DROP TABLE bug44571;
|
|
@ -1,22 +0,0 @@
|
|||
#
|
||||
# Bug#44571 InnoDB Plugin crashes on ADD INDEX
|
||||
# http://bugs.mysql.com/44571
|
||||
# Please also refer to related fix in
|
||||
# http://bugs.mysql.com/47621
|
||||
#
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
|
||||
ALTER TABLE bug44571 CHANGE foo bar INT;
|
||||
# Create index with the old column name will fail,
|
||||
# because the CHANGE foo bar is successful. And
|
||||
# the column name change would communicate to
|
||||
# InnoDB with the fix from bug #47621
|
||||
-- error ER_KEY_COLUMN_DOES_NOT_EXITS
|
||||
ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
|
||||
# The following create indexes should succeed,
|
||||
# indirectly confirm the CHANGE foo bar is successful.
|
||||
ALTER TABLE bug44571 ADD INDEX bug44571c (bar);
|
||||
DROP INDEX bug44571c ON bug44571;
|
||||
CREATE INDEX bug44571c ON bug44571 (bar);
|
||||
DROP TABLE bug44571;
|
|
@ -1,7 +0,0 @@
|
|||
set session transaction isolation level read committed;
|
||||
create table bug45357(a int, b int,key(b))engine=innodb;
|
||||
insert into bug45357 values (25170,6122);
|
||||
update bug45357 set a=1 where b=30131;
|
||||
delete from bug45357 where b < 20996;
|
||||
delete from bug45357 where b < 7001;
|
||||
drop table bug45357;
|
|
@ -1,10 +0,0 @@
|
|||
-- source include/have_innodb.inc
|
||||
|
||||
set session transaction isolation level read committed;
|
||||
|
||||
create table bug45357(a int, b int,key(b))engine=innodb;
|
||||
insert into bug45357 values (25170,6122);
|
||||
update bug45357 set a=1 where b=30131;
|
||||
delete from bug45357 where b < 20996;
|
||||
delete from bug45357 where b < 7001;
|
||||
drop table bug45357;
|
|
@ -1,19 +0,0 @@
|
|||
create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
|
||||
ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
|
||||
create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb;
|
||||
ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Warning 1280 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
|
||||
Error 1280 Incorrect index name 'GEN_CLUST_INDEX'
|
||||
Error 1005 Can't create table 'test.bug46000' (errno: -1)
|
||||
create table bug46000(id int) engine=innodb;
|
||||
create index GEN_CLUST_INDEX on bug46000(id);
|
||||
ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Warning 1280 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
|
||||
Error 1280 Incorrect index name 'GEN_CLUST_INDEX'
|
||||
Error 1030 Got error -1 from storage engine
|
||||
create index idx on bug46000(id);
|
||||
drop table bug46000;
|
|
@ -1,32 +0,0 @@
|
|||
# This is the test for bug 46000. We shall
|
||||
# block any index creation with the name of
|
||||
# "GEN_CLUST_INDEX", which is the reserved
|
||||
# name for innodb default primary index.
|
||||
|
||||
--source include/have_innodb.inc
|
||||
|
||||
# This 'create table' operation should fail because of
|
||||
# using the reserve name as its index name.
|
||||
--error ER_WRONG_NAME_FOR_INDEX
|
||||
create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
|
||||
|
||||
# Mixed upper/lower case of the reserved key words
|
||||
--error ER_WRONG_NAME_FOR_INDEX
|
||||
create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb;
|
||||
|
||||
show warnings;
|
||||
|
||||
create table bug46000(id int) engine=innodb;
|
||||
|
||||
# This 'create index' operation should fail.
|
||||
--error ER_WRONG_NAME_FOR_INDEX
|
||||
create index GEN_CLUST_INDEX on bug46000(id);
|
||||
|
||||
show warnings;
|
||||
|
||||
# This 'create index' operation should succeed, no
|
||||
# temp table left from last failed create index
|
||||
# operation.
|
||||
create index idx on bug46000(id);
|
||||
|
||||
drop table bug46000;
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue