Commit e5676d0a authored by Sergey Vojtovich's avatar Sergey Vojtovich

Merge innodb-5.1-ss6129 to mysql-5.1-bugteam.

parents 7d5e7599 c88db02f
...@@ -522,6 +522,8 @@ sub collect_one_suite($) ...@@ -522,6 +522,8 @@ sub collect_one_suite($)
next if ($test->{'name'} eq 'main.innodb_bug46000'); next if ($test->{'name'} eq 'main.innodb_bug46000');
# Disable for Innodb Plugin until the fix for Plugin is received # Disable for Innodb Plugin until the fix for Plugin is received
next if ($test->{'name'} eq 'main.innodb_bug44369'); next if ($test->{'name'} eq 'main.innodb_bug44369');
# Disable for Innodb Plugin until the fix for Plugin is received
next if ($test->{'name'} eq 'main.innodb_bug47777');
# Copy test options # Copy test options
my $new_test= My::Test->new(); my $new_test= My::Test->new();
while (my ($key, $value) = each(%$test)) while (my ($key, $value) = each(%$test))
......
...@@ -867,6 +867,7 @@ INSERT INTO t2 SELECT NULL FROM t1; ...@@ -867,6 +867,7 @@ INSERT INTO t2 SELECT NULL FROM t1;
Got one of the listed errors Got one of the listed errors
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; 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; CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (null); INSERT INTO t1 VALUES (null);
INSERT INTO t1 VALUES (null); INSERT INTO t1 VALUES (null);
...@@ -882,6 +883,12 @@ d1 ...@@ -882,6 +883,12 @@ d1
INSERT INTO t1 VALUES(null); INSERT INTO t1 VALUES(null);
Got one of the listed errors Got one of the listed errors
ALTER TABLE t1 AUTO_INCREMENT = 3; 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=4 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES(null); INSERT INTO t1 VALUES(null);
SELECT * FROM t1; SELECT * FROM t1;
d1 d1
...@@ -889,3 +896,233 @@ d1 ...@@ -889,3 +896,233 @@ d1
3 3
4 4
DROP TABLE t1; 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
auto_increment_offset 1
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;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` tinyint(4) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
-127 innodb
-1 innodb
1 NULL
2 NULL
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');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
INSERT INTO t1 VALUES (-127, 'innodb');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
1 NULL
2 innodb
3 innodb
4 NULL
DROP TABLE t1;
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;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` smallint(6) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
-32767 innodb
-1 innodb
1 NULL
2 NULL
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');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
INSERT INTO t1 VALUES (-32757, 'innodb');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
1 NULL
2 innodb
3 innodb
4 NULL
DROP TABLE t1;
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;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` mediumint(9) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
-8388607 innodb
-1 innodb
1 NULL
2 NULL
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');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
INSERT INTO t1 VALUES (-8388607, 'innodb');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
1 NULL
2 innodb
3 innodb
4 NULL
DROP TABLE t1;
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;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
-2147483647 innodb
-1 innodb
1 NULL
2 NULL
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');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
INSERT INTO t1 VALUES (-2147483647, 'innodb');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(10) unsigned NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
1 NULL
2 innodb
3 innodb
4 NULL
DROP TABLE t1;
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;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
-9223372036854775807 innodb
-1 innodb
1 NULL
2 NULL
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');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
1 NULL
2 innodb
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;
Table Create Table
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;
c1 c2
10 0
DROP TABLE T1;
...@@ -2,13 +2,13 @@ create table bug44369 (DB_ROW_ID int) engine=innodb; ...@@ -2,13 +2,13 @@ create table bug44369 (DB_ROW_ID int) engine=innodb;
ERROR HY000: Can't create table 'test.bug44369' (errno: -1) ERROR HY000: Can't create table 'test.bug44369' (errno: -1)
create table bug44369 (db_row_id int) engine=innodb; create table bug44369 (db_row_id int) engine=innodb;
ERROR HY000: Can't create table 'test.bug44369' (errno: -1) ERROR HY000: Can't create table 'test.bug44369' (errno: -1)
show errors; show warnings;
Level Code Message Level Code Message
Error 1005 Error creating table 'test/bug44369' with column name 'db_row_id'. 'db_row_id' is a reserved name. Please try to re-create the table with a different column name. Warning 1005 Error creating table 'test/bug44369' with column name 'db_row_id'. 'db_row_id' is a reserved name. Please try to re-create the table with a different column name.
Error 1005 Can't create table 'test.bug44369' (errno: -1) Error 1005 Can't create table 'test.bug44369' (errno: -1)
create table bug44369 (db_TRX_Id int) engine=innodb; create table bug44369 (db_TRX_Id int) engine=innodb;
ERROR HY000: Can't create table 'test.bug44369' (errno: -1) ERROR HY000: Can't create table 'test.bug44369' (errno: -1)
show errors; show warnings;
Level Code Message Level Code Message
Error 1005 Error creating table 'test/bug44369' with column name 'db_TRX_Id'. 'db_TRX_Id' is a reserved name. Please try to re-create the table with a different column name. Warning 1005 Error creating table 'test/bug44369' with column name 'db_TRX_Id'. 'db_TRX_Id' is a reserved name. Please try to re-create the table with a different column name.
Error 1005 Can't create table 'test.bug44369' (errno: -1) Error 1005 Can't create table 'test.bug44369' (errno: -1)
...@@ -2,16 +2,16 @@ create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb; ...@@ -2,16 +2,16 @@ create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
ERROR HY000: Can't create table 'test.bug46000' (errno: -1) ERROR HY000: Can't create table 'test.bug46000' (errno: -1)
create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb; create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb;
ERROR HY000: Can't create table 'test.bug46000' (errno: -1) ERROR HY000: Can't create table 'test.bug46000' (errno: -1)
show errors; show warnings;
Level Code Message Level Code Message
Error 1005 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index. Warning 1005 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
Error 1005 Can't create table 'test.bug46000' (errno: -1) Error 1005 Can't create table 'test.bug46000' (errno: -1)
create table bug46000(id int) engine=innodb; create table bug46000(id int) engine=innodb;
create index GEN_CLUST_INDEX on bug46000(id); create index GEN_CLUST_INDEX on bug46000(id);
ERROR HY000: Can't create table '#sql-temporary' (errno: -1) ERROR HY000: Can't create table '#sql-temporary' (errno: -1)
show errors; show warnings;
Level Code Message Level Code Message
Error 1005 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index. Warning 1005 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
Error 1005 Can't create table '#sql-temporary' (errno: -1) Error 1005 Can't create table '#sql-temporary' (errno: -1)
create index idx on bug46000(id); create index idx on bug46000(id);
drop table bug46000; drop table bug46000;
create table bug47777(c2 linestring not null, primary key (c2(1))) engine=innodb;
insert into bug47777 values (geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'));
select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
count(*)
1
update bug47777 set c2=GeomFromText('POINT(1 1)');
select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
count(*)
0
select count(*) from bug47777 where c2 = GeomFromText('POINT(1 1)');
count(*)
1
drop table bug47777;
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# #
############################################################################## ##############################################################################
kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild. kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
innodb_bug39438 : Bug#42383 2009-01-28 lsoares "This fails in embedded and on windows. Note that this test is not run on windows and on embedded in PB for main trees currently"
query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
partition_innodb_builtin : Bug#32430 2009-09-25 mattiasj Waiting for push of Innodb changes partition_innodb_builtin : Bug#32430 2009-09-25 mattiasj Waiting for push of Innodb changes
partition_innodb_plugin : Bug#32430 2009-09-25 mattiasj Waiting for push of Innodb changes partition_innodb_plugin : Bug#32430 2009-09-25 mattiasj Waiting for push of Innodb changes
innodb-autoinc : Bug#48482 2009-11-02 svoj innodb-autoinc.test fails with results difference
...@@ -482,6 +482,7 @@ DROP TABLE t2; ...@@ -482,6 +482,7 @@ DROP TABLE t2;
# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from # 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from
# the index (PRIMARY) # the index (PRIMARY)
# This test requires a restart of the server # 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; CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (null); INSERT INTO t1 VALUES (null);
INSERT INTO t1 VALUES (null); INSERT INTO t1 VALUES (null);
...@@ -492,9 +493,130 @@ SELECT * FROM t1; ...@@ -492,9 +493,130 @@ SELECT * FROM t1;
# The MySQL and InnoDB data dictionaries should now be out of sync. # The MySQL and InnoDB data dictionaries should now be out of sync.
# The select should print message to the error log # The select should print message to the error log
SELECT * FROM t1; SELECT * FROM t1;
# MySQL have made a change (http://lists.mysql.com/commits/75268) that no
# longer results in the two data dictionaries being out of sync. If they
# revert their changes then this check for ER_AUTOINC_READ_FAILED will need
# to be enabled.
-- error ER_AUTOINC_READ_FAILED,1467 -- error ER_AUTOINC_READ_FAILED,1467
INSERT INTO t1 VALUES(null); INSERT INTO t1 VALUES(null);
ALTER TABLE t1 AUTO_INCREMENT = 3; ALTER TABLE t1 AUTO_INCREMENT = 3;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES(null); INSERT INTO t1 VALUES(null);
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE 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.
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;
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
-- disable_result_log -- disable_result_log
# set packet size and reconnect # set packet size and reconnect
let $max_packet=`select @@global.max_allowed_packet`;
SET @@global.max_allowed_packet=16777216; SET @@global.max_allowed_packet=16777216;
--connect (newconn, localhost, root,,) --connect (newconn, localhost, root,,)
......
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
-- source include/have_innodb.inc -- source include/have_innodb.inc
--disable_query_log
call mtr.add_suppression("InnoDB: Error: table 'test/bug39438'");
--enable_query_log
SET storage_engine=InnoDB; SET storage_engine=InnoDB;
# we care only that the following SQL commands do not crash the server # we care only that the following SQL commands do not crash the server
......
...@@ -13,9 +13,9 @@ create table bug44369 (DB_ROW_ID int) engine=innodb; ...@@ -13,9 +13,9 @@ create table bug44369 (DB_ROW_ID int) engine=innodb;
--error ER_CANT_CREATE_TABLE --error ER_CANT_CREATE_TABLE
create table bug44369 (db_row_id int) engine=innodb; create table bug44369 (db_row_id int) engine=innodb;
show errors; show warnings;
--error ER_CANT_CREATE_TABLE --error ER_CANT_CREATE_TABLE
create table bug44369 (db_TRX_Id int) engine=innodb; create table bug44369 (db_TRX_Id int) engine=innodb;
show errors; show warnings;
...@@ -14,7 +14,7 @@ create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb; ...@@ -14,7 +14,7 @@ create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
--error ER_CANT_CREATE_TABLE --error ER_CANT_CREATE_TABLE
create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb; create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb;
show errors; show warnings;
create table bug46000(id int) engine=innodb; create table bug46000(id int) engine=innodb;
...@@ -24,7 +24,7 @@ create table bug46000(id int) engine=innodb; ...@@ -24,7 +24,7 @@ create table bug46000(id int) engine=innodb;
create index GEN_CLUST_INDEX on bug46000(id); create index GEN_CLUST_INDEX on bug46000(id);
--replace_regex /'[^']*test.#sql-[0-9a-f_]*'/'#sql-temporary'/ --replace_regex /'[^']*test.#sql-[0-9a-f_]*'/'#sql-temporary'/
show errors; show warnings;
# This 'create index' operation should succeed, no # This 'create index' operation should succeed, no
# temp table left from last failed create index # temp table left from last failed create index
......
# This is the test for bug 47777. GEOMETRY
# data is treated as BLOB data in innodb.
# Consequently, its key value generation/storing
# should follow the process for the BLOB
# datatype as well.
--source include/have_innodb.inc
create table bug47777(c2 linestring not null, primary key (c2(1))) engine=innodb;
insert into bug47777 values (geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'));
# Verify correct row get inserted.
select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
# Update table bug47777 should be successful.
update bug47777 set c2=GeomFromText('POINT(1 1)');
# Verify the row get updated successfully. The original
# c2 value should be changed to GeomFromText('POINT(1 1)').
select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
select count(*) from bug47777 where c2 = GeomFromText('POINT(1 1)');
drop table bug47777;
...@@ -41,7 +41,7 @@ have disabled the InnoDB inlining in this file. */ ...@@ -41,7 +41,7 @@ have disabled the InnoDB inlining in this file. */
#include <mysql/plugin.h> #include <mysql/plugin.h>
#ifndef MYSQL_SERVER #ifndef MYSQL_SERVER
/* This is needed because of Bug #3596. Let us hope that pthread_mutex_t /* This is needed because of Bug #3596. Let us hope that pthread_mutex_t
is defined the same in both builds: the MySQL server and the InnoDB plugin. */ is defined the same in both builds: the MySQL server and the InnoDB plugin. */
extern pthread_mutex_t LOCK_thread_count; extern pthread_mutex_t LOCK_thread_count;
#endif /* MYSQL_SERVER */ #endif /* MYSQL_SERVER */
...@@ -54,6 +54,7 @@ static ulong commit_threads = 0; ...@@ -54,6 +54,7 @@ static ulong commit_threads = 0;
static pthread_mutex_t commit_threads_m; static pthread_mutex_t commit_threads_m;
static pthread_cond_t commit_cond; static pthread_cond_t commit_cond;
static pthread_mutex_t commit_cond_m; static pthread_mutex_t commit_cond_m;
static pthread_mutex_t analyze_mutex;
static bool innodb_inited = 0; static bool innodb_inited = 0;
/* /*
...@@ -1932,6 +1933,7 @@ innobase_init( ...@@ -1932,6 +1933,7 @@ innobase_init(
pthread_mutex_init(&prepare_commit_mutex, MY_MUTEX_INIT_FAST); pthread_mutex_init(&prepare_commit_mutex, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&commit_threads_m, MY_MUTEX_INIT_FAST); pthread_mutex_init(&commit_threads_m, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&commit_cond_m, MY_MUTEX_INIT_FAST); pthread_mutex_init(&commit_cond_m, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&analyze_mutex, MY_MUTEX_INIT_FAST);
pthread_cond_init(&commit_cond, NULL); pthread_cond_init(&commit_cond, NULL);
innodb_inited= 1; innodb_inited= 1;
...@@ -1971,6 +1973,7 @@ innobase_end(handlerton *hton, ha_panic_function type) ...@@ -1971,6 +1973,7 @@ innobase_end(handlerton *hton, ha_panic_function type)
pthread_mutex_destroy(&prepare_commit_mutex); pthread_mutex_destroy(&prepare_commit_mutex);
pthread_mutex_destroy(&commit_threads_m); pthread_mutex_destroy(&commit_threads_m);
pthread_mutex_destroy(&commit_cond_m); pthread_mutex_destroy(&commit_cond_m);
pthread_mutex_destroy(&analyze_mutex);
pthread_cond_destroy(&commit_cond); pthread_cond_destroy(&commit_cond);
} }
...@@ -2215,6 +2218,8 @@ innobase_rollback( ...@@ -2215,6 +2218,8 @@ innobase_rollback(
innobase_release_stat_resources(trx); innobase_release_stat_resources(trx);
trx->n_autoinc_rows = 0; /* Reset the number AUTO-INC rows required */
/* If we had reserved the auto-inc lock for some table (if /* If we had reserved the auto-inc lock for some table (if
we come here to roll back the latest SQL statement) we we come here to roll back the latest SQL statement) we
release it now before a possibly lengthy rollback */ release it now before a possibly lengthy rollback */
...@@ -3240,7 +3245,10 @@ ha_innobase::store_key_val_for_row( ...@@ -3240,7 +3245,10 @@ ha_innobase::store_key_val_for_row(
} else if (mysql_type == MYSQL_TYPE_TINY_BLOB } else if (mysql_type == MYSQL_TYPE_TINY_BLOB
|| mysql_type == MYSQL_TYPE_MEDIUM_BLOB || mysql_type == MYSQL_TYPE_MEDIUM_BLOB
|| mysql_type == MYSQL_TYPE_BLOB || mysql_type == MYSQL_TYPE_BLOB
|| mysql_type == MYSQL_TYPE_LONG_BLOB) { || mysql_type == MYSQL_TYPE_LONG_BLOB
/* MYSQL_TYPE_GEOMETRY data is treated
as BLOB data in innodb. */
|| mysql_type == MYSQL_TYPE_GEOMETRY) {
CHARSET_INFO* cs; CHARSET_INFO* cs;
ulint key_len; ulint key_len;
...@@ -5186,7 +5194,7 @@ create_table_def( ...@@ -5186,7 +5194,7 @@ create_table_def(
if (dict_col_name_is_reserved(field->field_name)){ if (dict_col_name_is_reserved(field->field_name)){
push_warning_printf( push_warning_printf(
(THD*) trx->mysql_thd, (THD*) trx->mysql_thd,
MYSQL_ERROR::WARN_LEVEL_ERROR, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_CANT_CREATE_TABLE, ER_CANT_CREATE_TABLE,
"Error creating table '%s' with " "Error creating table '%s' with "
"column name '%s'. '%s' is a " "column name '%s'. '%s' is a "
...@@ -5433,13 +5441,15 @@ ha_innobase::create( ...@@ -5433,13 +5441,15 @@ ha_innobase::create(
1. <database_name>/<table_name>: for normal table creation 1. <database_name>/<table_name>: for normal table creation
2. full path: for temp table creation, or sym link 2. full path: for temp table creation, or sym link
When srv_file_per_table is on, check for full path pattern, i.e. When srv_file_per_table is on and mysqld_embedded is off,
check for full path pattern, i.e.
X:\dir\..., X is a driver letter, or X:\dir\..., X is a driver letter, or
\\dir1\dir2\..., UNC path \\dir1\dir2\..., UNC path
returns error if it is in full path format, but not creating a temp. returns error if it is in full path format, but not creating a temp.
table. Currently InnoDB does not support symbolic link on Windows. */ table. Currently InnoDB does not support symbolic link on Windows. */
if (srv_file_per_table if (srv_file_per_table
&& !mysqld_embedded
&& (!create_info->options & HA_LEX_CREATE_TMP_TABLE)) { && (!create_info->options & HA_LEX_CREATE_TMP_TABLE)) {
if ((name[1] == ':') if ((name[1] == ':')
...@@ -5595,18 +5605,22 @@ ha_innobase::create( ...@@ -5595,18 +5605,22 @@ ha_innobase::create(
setup at this stage and so we use thd. */ setup at this stage and so we use thd. */
/* We need to copy the AUTOINC value from the old table if /* We need to copy the AUTOINC value from the old table if
this is an ALTER TABLE. */ this is an ALTER TABLE or CREATE INDEX because CREATE INDEX
does a table copy too. */
if (((create_info->used_fields & HA_CREATE_USED_AUTO) if (((create_info->used_fields & HA_CREATE_USED_AUTO)
|| thd_sql_command(thd) == SQLCOM_ALTER_TABLE) || thd_sql_command(thd) == SQLCOM_ALTER_TABLE
&& create_info->auto_increment_value != 0) { || thd_sql_command(thd) == SQLCOM_CREATE_INDEX)
&& create_info->auto_increment_value > 0) {
/* Query was ALTER TABLE...AUTO_INCREMENT = x; or
CREATE TABLE ...AUTO_INCREMENT = x; Find out a table /* Query was one of :
definition from the dictionary and get the current value CREATE TABLE ...AUTO_INCREMENT = x; or
of the auto increment field. Set a new value to the ALTER TABLE...AUTO_INCREMENT = x; or
auto increment field if the value is greater than the CREATE INDEX x on t(...);
maximum value in the column. */ Find out a table definition from the dictionary and get
the current value of the auto increment field. Set a new
value to the auto increment field if the value is greater
than the maximum value in the column. */
auto_inc_value = create_info->auto_increment_value; auto_inc_value = create_info->auto_increment_value;
...@@ -6428,9 +6442,15 @@ ha_innobase::analyze( ...@@ -6428,9 +6442,15 @@ ha_innobase::analyze(
THD* thd, /* in: connection thread handle */ THD* thd, /* in: connection thread handle */
HA_CHECK_OPT* check_opt) /* in: currently ignored */ HA_CHECK_OPT* check_opt) /* in: currently ignored */
{ {
/* Serialize ANALYZE TABLE inside InnoDB, see
Bug#38996 Race condition in ANALYZE TABLE */
pthread_mutex_lock(&analyze_mutex);
/* Simply call ::info() with all the flags */ /* Simply call ::info() with all the flags */
info(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE); info(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE);
pthread_mutex_unlock(&analyze_mutex);
return(0); return(0);
} }
...@@ -7866,6 +7886,7 @@ ha_innobase::get_auto_increment( ...@@ -7866,6 +7886,7 @@ ha_innobase::get_auto_increment(
AUTOINC counter after attempting to insert the row. */ AUTOINC counter after attempting to insert the row. */
if (innobase_autoinc_lock_mode != AUTOINC_OLD_STYLE_LOCKING) { if (innobase_autoinc_lock_mode != AUTOINC_OLD_STYLE_LOCKING) {
ulonglong need; ulonglong need;
ulonglong current;
ulonglong next_value; ulonglong next_value;
ulonglong col_max_value; ulonglong col_max_value;
...@@ -7874,11 +7895,12 @@ ha_innobase::get_auto_increment( ...@@ -7874,11 +7895,12 @@ ha_innobase::get_auto_increment(
col_max_value = innobase_get_int_col_max_value( col_max_value = innobase_get_int_col_max_value(
table->next_number_field); table->next_number_field);
current = *first_value > col_max_value ? autoinc : *first_value;
need = *nb_reserved_values * increment; need = *nb_reserved_values * increment;
/* Compute the last value in the interval */ /* Compute the last value in the interval */
next_value = innobase_next_autoinc( next_value = innobase_next_autoinc(
*first_value, need, offset, col_max_value); current, need, offset, col_max_value);
prebuilt->autoinc_last_value = next_value; prebuilt->autoinc_last_value = next_value;
...@@ -8503,7 +8525,7 @@ innobase_index_name_is_reserved( ...@@ -8503,7 +8525,7 @@ innobase_index_name_is_reserved(
innobase_index_reserve_name) == 0) { innobase_index_reserve_name) == 0) {
/* Push warning to mysql */ /* Push warning to mysql */
push_warning_printf((THD*) trx->mysql_thd, push_warning_printf((THD*) trx->mysql_thd,
MYSQL_ERROR::WARN_LEVEL_ERROR, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_CANT_CREATE_TABLE, ER_CANT_CREATE_TABLE,
"Cannot Create Index with name " "Cannot Create Index with name "
"'%s'. The name is reserved " "'%s'. The name is reserved "
......
...@@ -591,6 +591,7 @@ os_mem_alloc_large( ...@@ -591,6 +591,7 @@ os_mem_alloc_large(
fprintf(stderr, "InnoDB: HugeTLB: Warning: Failed to" fprintf(stderr, "InnoDB: HugeTLB: Warning: Failed to"
" attach shared memory segment, errno %d\n", " attach shared memory segment, errno %d\n",
errno); errno);
ptr = NULL;
} }
/* Remove the shared memory segment so that it will be /* Remove the shared memory segment so that it will be
......
...@@ -2089,7 +2089,7 @@ Scans a table create SQL string and adds to the data dictionary ...@@ -2089,7 +2089,7 @@ Scans a table create SQL string and adds to the data dictionary
the foreign key constraints declared in the string. This function the foreign key constraints declared in the string. This function
should be called after the indexes for a table have been created. should be called after the indexes for a table have been created.
Each foreign key constraint must be accompanied with indexes in Each foreign key constraint must be accompanied with indexes in
bot participating tables. The indexes are allowed to contain more both participating tables. The indexes are allowed to contain more
fields than mentioned in the constraint. Check also that foreign key fields than mentioned in the constraint. Check also that foreign key
constraints which reference this table are ok. */ constraints which reference this table are ok. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment