mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
merged 5.1-innodb
This commit is contained in:
4
mysql-test/include/have_innodb_plugin.inc
Normal file
4
mysql-test/include/have_innodb_plugin.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
disable_query_log;
|
||||
--require r/true.require
|
||||
SELECT (plugin_library LIKE 'ha_innodb_plugin%') AS `TRUE` FROM information_schema.plugins WHERE LOWER(plugin_name) = 'innodb' AND LOWER(plugin_status) = 'active';
|
||||
enable_query_log;
|
@@ -70,11 +70,20 @@ my $skip_test_reg;
|
||||
|
||||
# Related to adding InnoDB plugin combinations
|
||||
my $lib_innodb_plugin;
|
||||
my $do_innodb_plugin;
|
||||
|
||||
# If "Quick collect", set to 1 once a test to run has been found.
|
||||
my $some_test_found;
|
||||
|
||||
sub find_innodb_plugin {
|
||||
$lib_innodb_plugin=
|
||||
my_find_file($::basedir,
|
||||
["storage/innodb_plugin", "storage/innodb_plugin/.libs",
|
||||
"lib/mysql/plugin", "lib/plugin"],
|
||||
["ha_innodb_plugin.dll", "ha_innodb_plugin.so",
|
||||
"ha_innodb_plugin.sl"],
|
||||
NOT_REQUIRED);
|
||||
}
|
||||
|
||||
sub init_pattern {
|
||||
my ($from, $what)= @_;
|
||||
return undef unless defined $from;
|
||||
@@ -107,16 +116,7 @@ sub collect_test_cases ($$$) {
|
||||
$do_test_reg= init_pattern($do_test, "--do-test");
|
||||
$skip_test_reg= init_pattern($skip_test, "--skip-test");
|
||||
|
||||
$lib_innodb_plugin=
|
||||
my_find_file($::basedir,
|
||||
["storage/innodb_plugin", "storage/innodb_plugin/.libs",
|
||||
"lib/mysql/plugin", "lib/plugin"],
|
||||
["ha_innodb_plugin.dll", "ha_innodb_plugin.so",
|
||||
"ha_innodb_plugin.sl"],
|
||||
NOT_REQUIRED);
|
||||
$do_innodb_plugin= ($::mysql_version_id >= 50100 &&
|
||||
!(IS_WINDOWS && $::opt_embedded_server) &&
|
||||
$lib_innodb_plugin);
|
||||
&find_innodb_plugin;
|
||||
|
||||
# If not reordering, we also shouldn't group by suites, unless
|
||||
# no test cases were named.
|
||||
@@ -504,73 +504,6 @@ sub collect_one_suite($)
|
||||
}
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Testing InnoDB plugin.
|
||||
# ----------------------------------------------------------------------
|
||||
if ($do_innodb_plugin)
|
||||
{
|
||||
my @new_cases;
|
||||
my $sep= (IS_WINDOWS) ? ';' : ':';
|
||||
|
||||
foreach my $test (@cases)
|
||||
{
|
||||
next if (!$test->{'innodb_test'});
|
||||
# If skipped due to no builtin innodb, we can still run it with plugin
|
||||
next if ($test->{'skip'} && $test->{comment} ne "No innodb support");
|
||||
# Exceptions
|
||||
next if ($test->{'name'} eq 'main.innodb'); # Failed with wrong errno (fk)
|
||||
next if ($test->{'name'} eq 'main.index_merge_innodb'); # Explain diff
|
||||
# innodb_file_per_table is rw with innodb_plugin
|
||||
next if ($test->{'name'} eq 'sys_vars.innodb_file_per_table_basic');
|
||||
# innodb_lock_wait_timeout is rw with innodb_plugin
|
||||
next if ($test->{'name'} eq 'sys_vars.innodb_lock_wait_timeout_basic');
|
||||
# Diff around innodb_thread_concurrency variable
|
||||
next if ($test->{'name'} eq 'sys_vars.innodb_thread_concurrency_basic');
|
||||
# Can't work with InnoPlug. Test framework needs to be re-designed.
|
||||
next if ($test->{'name'} eq 'main.innodb_bug46000');
|
||||
# Fails with innodb plugin
|
||||
next if ($test->{'name'} eq 'main.innodb-autoinc');
|
||||
# Fails with innodb plugin: r6185 Testcases changes not included
|
||||
next if ($test->{'name'} eq 'main.innodb_bug44369');
|
||||
# Fix for BUG47621 is not in InnoDB plugin
|
||||
next if ($test->{'name'} eq 'main.innodb_bug21704');
|
||||
next if ($test->{'name'} eq 'main.innodb_bug47621');
|
||||
# Copy test options
|
||||
my $new_test= My::Test->new();
|
||||
while (my ($key, $value) = each(%$test))
|
||||
{
|
||||
if (ref $value eq "ARRAY")
|
||||
{
|
||||
push(@{$new_test->{$key}}, @$value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_test->{$key}= $value unless ($key eq 'skip');
|
||||
}
|
||||
}
|
||||
my $plugin_filename= basename($lib_innodb_plugin);
|
||||
my $plugin_list= "innodb=$plugin_filename" . $sep . "innodb_locks=$plugin_filename";
|
||||
push(@{$new_test->{master_opt}}, '--ignore-builtin-innodb');
|
||||
push(@{$new_test->{master_opt}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
|
||||
push(@{$new_test->{master_opt}}, "--plugin_load=$plugin_list");
|
||||
push(@{$new_test->{slave_opt}}, '--ignore-builtin-innodb');
|
||||
push(@{$new_test->{slave_opt}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
|
||||
push(@{$new_test->{slave_opt}}, "--plugin_load=$plugin_list");
|
||||
if ($new_test->{combination})
|
||||
{
|
||||
$new_test->{combination}.= '+innodb_plugin';
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_test->{combination}= 'innodb_plugin';
|
||||
}
|
||||
push(@new_cases, $new_test);
|
||||
}
|
||||
push(@cases, @new_cases);
|
||||
}
|
||||
# ----------------------------------------------------------------------
|
||||
# End of testing InnoDB plugin.
|
||||
# ----------------------------------------------------------------------
|
||||
optimize_cases(\@cases);
|
||||
#print_testcases(@cases);
|
||||
|
||||
@@ -1005,11 +938,38 @@ sub collect_one_test_case {
|
||||
{
|
||||
# innodb is not supported, skip it
|
||||
$tinfo->{'skip'}= 1;
|
||||
# This comment is checked for running with innodb plugin (see above),
|
||||
# please keep that in mind if changing the text.
|
||||
$tinfo->{'comment'}= "No innodb support";
|
||||
# But continue processing if we may run it with innodb plugin
|
||||
return $tinfo unless $do_innodb_plugin;
|
||||
return $tinfo;
|
||||
}
|
||||
}
|
||||
elsif ( $tinfo->{'innodb_plugin_test'} )
|
||||
{
|
||||
# This is a test that needs the innodb plugin
|
||||
if (!&find_innodb_plugin)
|
||||
{
|
||||
# innodb plugin is not supported, skip it
|
||||
$tinfo->{'skip'}= 1;
|
||||
$tinfo->{'comment'}= "No innodb plugin support";
|
||||
return $tinfo;
|
||||
}
|
||||
|
||||
my $sep= (IS_WINDOWS) ? ';' : ':';
|
||||
my $plugin_filename= basename($lib_innodb_plugin);
|
||||
my $plugin_list=
|
||||
"innodb=$plugin_filename$sep" .
|
||||
"innodb_trx=$plugin_filename$sep" .
|
||||
"innodb_locks=$plugin_filename$sep" .
|
||||
"innodb_lock_waits=$plugin_filename$sep" .
|
||||
"innodb_cmp=$plugin_filename$sep" .
|
||||
"innodb_cmp_reset=$plugin_filename$sep" .
|
||||
"innodb_cmpmem=$plugin_filename$sep" .
|
||||
"innodb_cmpmem_reset=$plugin_filename";
|
||||
|
||||
foreach my $k ('master_opt', 'slave_opt')
|
||||
{
|
||||
push(@{$tinfo->{$k}}, '--ignore-builtin-innodb');
|
||||
push(@{$tinfo->{$k}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
|
||||
push(@{$tinfo->{$k}}, "--plugin-load=$plugin_list");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1137,6 +1097,7 @@ my @tags=
|
||||
["include/have_log_bin.inc", "need_binlog", 1],
|
||||
|
||||
["include/have_innodb.inc", "innodb_test", 1],
|
||||
["include/have_innodb_plugin.inc", "innodb_plugin_test", 1],
|
||||
["include/big_test.inc", "big_test", 1],
|
||||
["include/have_debug.inc", "need_debug", 1],
|
||||
["include/have_ndb.inc", "ndb_test", 1],
|
||||
|
@@ -202,7 +202,7 @@ eval kill query $ID;
|
||||
rollback;
|
||||
|
||||
connection con2;
|
||||
--error 0,ER_QUERY_INTERRUPTED
|
||||
--error 0,ER_QUERY_INTERRUPTED,ER_LOCK_WAIT_TIMEOUT
|
||||
reap;
|
||||
# todo 1,2 above
|
||||
rollback;
|
||||
|
@@ -1,4 +0,0 @@
|
||||
disable_query_log;
|
||||
--require r/true.require
|
||||
select (PLUGIN_LIBRARY LIKE 'ha_innodb_plugin%') as `TRUE` from information_schema.plugins where PLUGIN_NAME='InnoDB';
|
||||
enable_query_log;
|
@@ -13,18 +13,18 @@ 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
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES(null);
|
||||
SELECT * FROM t1;
|
||||
d1
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
DROP TABLE t1;
|
2429
mysql-test/suite/innodb/r/innodb.result
Normal file
2429
mysql-test/suite/innodb/r/innodb.result
Normal file
File diff suppressed because it is too large
Load Diff
13
mysql-test/suite/innodb/r/innodb_bug51920.result
Normal file
13
mysql-test/suite/innodb/r/innodb_bug51920.result
Normal file
@@ -0,0 +1,13 @@
|
||||
CREATE TABLE bug51920 (i INT) ENGINE=InnoDB;
|
||||
INSERT INTO bug51920 VALUES (1);
|
||||
BEGIN;
|
||||
SELECT * FROM bug51920 FOR UPDATE;
|
||||
i
|
||||
1
|
||||
UPDATE bug51920 SET i=2;
|
||||
SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
|
||||
WHERE INFO="UPDATE bug51920 SET i=2"
|
||||
INTO @thread_id;
|
||||
KILL @thread_id;
|
||||
Got one of the listed errors
|
||||
DROP TABLE bug51920;
|
26
mysql-test/suite/innodb/r/innodb_bug52663.result
Normal file
26
mysql-test/suite/innodb/r/innodb_bug52663.result
Normal file
@@ -0,0 +1,26 @@
|
||||
set session transaction isolation level read committed;
|
||||
create table innodb_bug52663 (what varchar(5), id integer, count integer, primary key
|
||||
(what, id)) engine=innodb;
|
||||
insert into innodb_bug52663 values ('total', 0, 0);
|
||||
begin;
|
||||
set session transaction isolation level read committed;
|
||||
begin;
|
||||
update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
|
||||
select * from innodb_bug52663;
|
||||
what id count
|
||||
total 0 1
|
||||
update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
select * from innodb_bug52663;
|
||||
what id count
|
||||
total 0 0
|
||||
commit;
|
||||
update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
|
||||
commit;
|
||||
select * from innodb_bug52663;
|
||||
what id count
|
||||
total 0 2
|
||||
select * from innodb_bug52663;
|
||||
what id count
|
||||
total 0 2
|
||||
drop table innodb_bug52663;
|
880
mysql-test/suite/innodb/r/innodb_misc1.result
Normal file
880
mysql-test/suite/innodb/r/innodb_misc1.result
Normal file
@@ -0,0 +1,880 @@
|
||||
drop table if exists t1,t2,t3,t4;
|
||||
drop database if exists mysqltest;
|
||||
create table t1 (v varchar(16384)) engine=innodb;
|
||||
drop table t1;
|
||||
create table t1 (a char(1), b char(1), key(a, b)) engine=innodb;
|
||||
insert into t1 values ('8', '6'), ('4', '7');
|
||||
select min(a) from t1;
|
||||
min(a)
|
||||
4
|
||||
select min(b) from t1 where a='8';
|
||||
min(b)
|
||||
6
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=innodb;
|
||||
insert into t1 (b) values (1);
|
||||
replace into t1 (b) values (2), (1), (3);
|
||||
select * from t1;
|
||||
a b
|
||||
3 1
|
||||
2 2
|
||||
4 3
|
||||
truncate table t1;
|
||||
insert into t1 (b) values (1);
|
||||
replace into t1 (b) values (2);
|
||||
replace into t1 (b) values (1);
|
||||
replace into t1 (b) values (3);
|
||||
select * from t1;
|
||||
a b
|
||||
3 1
|
||||
2 2
|
||||
4 3
|
||||
drop table t1;
|
||||
create table t1 (rowid int not null auto_increment, val int not null,primary
|
||||
key (rowid), unique(val)) engine=innodb;
|
||||
replace into t1 (val) values ('1'),('2');
|
||||
replace into t1 (val) values ('1'),('2');
|
||||
insert into t1 (val) values ('1'),('2');
|
||||
ERROR 23000: Duplicate entry '1' for key 'val'
|
||||
select * from t1;
|
||||
rowid val
|
||||
3 1
|
||||
4 2
|
||||
drop table t1;
|
||||
create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB;
|
||||
insert into t1 (val) values (1);
|
||||
update t1 set a=2 where a=1;
|
||||
insert into t1 (val) values (1);
|
||||
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
|
||||
select * from t1;
|
||||
a val
|
||||
2 1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (GRADE DECIMAL(4) NOT NULL, PRIMARY KEY (GRADE)) ENGINE=INNODB;
|
||||
INSERT INTO t1 (GRADE) VALUES (151),(252),(343);
|
||||
SELECT GRADE FROM t1 WHERE GRADE > 160 AND GRADE < 300;
|
||||
GRADE
|
||||
252
|
||||
SELECT GRADE FROM t1 WHERE GRADE= 151;
|
||||
GRADE
|
||||
151
|
||||
DROP TABLE t1;
|
||||
create table t1 (f1 varchar(10), f2 varchar(10), primary key (f1,f2)) engine=innodb;
|
||||
create table t2 (f3 varchar(10), f4 varchar(10), key (f4)) engine=innodb;
|
||||
insert into t2 values ('aa','cc');
|
||||
insert into t1 values ('aa','bb'),('aa','cc');
|
||||
delete t1 from t1,t2 where f1=f3 and f4='cc';
|
||||
select * from t1;
|
||||
f1 f2
|
||||
drop table t1,t2;
|
||||
CREATE TABLE t1 (
|
||||
id INTEGER NOT NULL AUTO_INCREMENT, PRIMARY KEY (id)
|
||||
) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (
|
||||
id INTEGER NOT NULL,
|
||||
FOREIGN KEY (id) REFERENCES t1 (id)
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO t1 (id) VALUES (NULL);
|
||||
SELECT * FROM t1;
|
||||
id
|
||||
1
|
||||
TRUNCATE t1;
|
||||
INSERT INTO t1 (id) VALUES (NULL);
|
||||
SELECT * FROM t1;
|
||||
id
|
||||
1
|
||||
DELETE FROM t1;
|
||||
TRUNCATE t1;
|
||||
INSERT INTO t1 (id) VALUES (NULL);
|
||||
SELECT * FROM t1;
|
||||
id
|
||||
1
|
||||
DROP TABLE t2, t1;
|
||||
CREATE TABLE t1
|
||||
(
|
||||
id INT PRIMARY KEY
|
||||
) ENGINE=InnoDB;
|
||||
CREATE TEMPORARY TABLE t2
|
||||
(
|
||||
id INT NOT NULL PRIMARY KEY,
|
||||
b INT,
|
||||
FOREIGN KEY (b) REFERENCES test.t1(id)
|
||||
) ENGINE=InnoDB;
|
||||
Got one of the listed errors
|
||||
DROP TABLE t1;
|
||||
create table t1 (col1 varchar(2000), index (col1(767)))
|
||||
character set = latin1 engine = innodb;
|
||||
create table t2 (col1 char(255), index (col1))
|
||||
character set = latin1 engine = innodb;
|
||||
create table t3 (col1 binary(255), index (col1))
|
||||
character set = latin1 engine = innodb;
|
||||
create table t4 (col1 varchar(767), index (col1))
|
||||
character set = latin1 engine = innodb;
|
||||
create table t5 (col1 varchar(767) primary key)
|
||||
character set = latin1 engine = innodb;
|
||||
create table t6 (col1 varbinary(767) primary key)
|
||||
character set = latin1 engine = innodb;
|
||||
create table t7 (col1 text, index(col1(767)))
|
||||
character set = latin1 engine = innodb;
|
||||
create table t8 (col1 blob, index(col1(767)))
|
||||
character set = latin1 engine = innodb;
|
||||
create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2))
|
||||
character set = latin1 engine = innodb;
|
||||
show create table t9;
|
||||
Table Create Table
|
||||
t9 CREATE TABLE `t9` (
|
||||
`col1` varchar(512) DEFAULT NULL,
|
||||
`col2` varchar(512) DEFAULT NULL,
|
||||
KEY `col1` (`col1`,`col2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
drop table t1, t2, t3, t4, t5, t6, t7, t8, t9;
|
||||
create table t1 (col1 varchar(768), index(col1))
|
||||
character set = latin1 engine = innodb;
|
||||
Warnings:
|
||||
Warning 1071 Specified key was too long; max key length is 767 bytes
|
||||
create table t2 (col1 varbinary(768), index(col1))
|
||||
character set = latin1 engine = innodb;
|
||||
Warnings:
|
||||
Warning 1071 Specified key was too long; max key length is 767 bytes
|
||||
create table t3 (col1 text, index(col1(768)))
|
||||
character set = latin1 engine = innodb;
|
||||
Warnings:
|
||||
Warning 1071 Specified key was too long; max key length is 767 bytes
|
||||
create table t4 (col1 blob, index(col1(768)))
|
||||
character set = latin1 engine = innodb;
|
||||
Warnings:
|
||||
Warning 1071 Specified key was too long; max key length is 767 bytes
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`col1` varchar(768) DEFAULT NULL,
|
||||
KEY `col1` (`col1`(767))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
drop table t1, t2, t3, t4;
|
||||
create table t1 (col1 varchar(768) primary key)
|
||||
character set = latin1 engine = innodb;
|
||||
ERROR 42000: Specified key was too long; max key length is 767 bytes
|
||||
create table t2 (col1 varbinary(768) primary key)
|
||||
character set = latin1 engine = innodb;
|
||||
ERROR 42000: Specified key was too long; max key length is 767 bytes
|
||||
create table t3 (col1 text, primary key(col1(768)))
|
||||
character set = latin1 engine = innodb;
|
||||
ERROR 42000: Specified key was too long; max key length is 767 bytes
|
||||
create table t4 (col1 blob, primary key(col1(768)))
|
||||
character set = latin1 engine = innodb;
|
||||
ERROR 42000: Specified key was too long; max key length is 767 bytes
|
||||
CREATE TABLE t1
|
||||
(
|
||||
id INT PRIMARY KEY
|
||||
) ENGINE=InnoDB;
|
||||
CREATE TABLE t2
|
||||
(
|
||||
v INT,
|
||||
CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id)
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES(2);
|
||||
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
|
||||
INSERT INTO t1 VALUES(1);
|
||||
INSERT INTO t2 VALUES(1);
|
||||
DELETE FROM t1 WHERE id = 1;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
|
||||
DROP TABLE t1;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
DROP TABLE t1;
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
INSERT INTO t2 VALUES(3);
|
||||
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
|
||||
DROP TABLE t2;
|
||||
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
|
||||
insert into t1 values (1),(2);
|
||||
set autocommit=0;
|
||||
checksum table t1;
|
||||
Table Checksum
|
||||
test.t1 1531596814
|
||||
insert into t1 values(3);
|
||||
checksum table t1;
|
||||
Table Checksum
|
||||
test.t1 1531596814
|
||||
commit;
|
||||
checksum table t1;
|
||||
Table Checksum
|
||||
test.t1 2050879373
|
||||
commit;
|
||||
drop table t1;
|
||||
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
|
||||
insert into t1 values (1),(2);
|
||||
set autocommit=1;
|
||||
checksum table t1;
|
||||
Table Checksum
|
||||
test.t1 1531596814
|
||||
set autocommit=1;
|
||||
insert into t1 values(3);
|
||||
checksum table t1;
|
||||
Table Checksum
|
||||
test.t1 2050879373
|
||||
drop table t1;
|
||||
set foreign_key_checks=0;
|
||||
create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb;
|
||||
create table t1(a char(10) primary key, b varchar(20)) engine = innodb;
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 150)
|
||||
set foreign_key_checks=1;
|
||||
drop table t2;
|
||||
set foreign_key_checks=0;
|
||||
create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;
|
||||
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8;
|
||||
ERROR HY000: Can't create table 'test.t2' (errno: 150)
|
||||
set foreign_key_checks=1;
|
||||
drop table t1;
|
||||
set foreign_key_checks=0;
|
||||
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb;
|
||||
create table t1(a varchar(10) primary key) engine = innodb;
|
||||
alter table t1 modify column a int;
|
||||
Got one of the listed errors
|
||||
set foreign_key_checks=1;
|
||||
drop table t2,t1;
|
||||
set foreign_key_checks=0;
|
||||
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
|
||||
create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;
|
||||
alter table t1 convert to character set utf8;
|
||||
set foreign_key_checks=1;
|
||||
drop table t2,t1;
|
||||
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;
|
||||
rename table t3 to t1;
|
||||
ERROR HY000: Error on rename of './test/t3' to './test/t1' (errno: 150)
|
||||
set foreign_key_checks=1;
|
||||
drop table t2,t3;
|
||||
create table t1(a int primary key) row_format=redundant engine=innodb;
|
||||
create table t2(a int primary key,constraint foreign key(a)references t1(a)) row_format=compact engine=innodb;
|
||||
create table t3(a int primary key) row_format=compact engine=innodb;
|
||||
create table t4(a int primary key,constraint foreign key(a)references t3(a)) row_format=redundant engine=innodb;
|
||||
insert into t1 values(1);
|
||||
insert into t3 values(1);
|
||||
insert into t2 values(2);
|
||||
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
|
||||
insert into t4 values(2);
|
||||
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
|
||||
insert into t2 values(1);
|
||||
insert into t4 values(1);
|
||||
update t1 set a=2;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
|
||||
update t2 set a=2;
|
||||
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
|
||||
update t3 set a=2;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
|
||||
update t4 set a=2;
|
||||
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
|
||||
truncate t1;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
|
||||
truncate t3;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
|
||||
truncate t2;
|
||||
truncate t4;
|
||||
truncate t1;
|
||||
truncate t3;
|
||||
drop table t4,t3,t2,t1;
|
||||
create table t1 (a varchar(255) character set utf8,
|
||||
b varchar(255) character set utf8,
|
||||
c varchar(255) character set utf8,
|
||||
d varchar(255) character set utf8,
|
||||
key (a,b,c,d)) engine=innodb;
|
||||
drop table t1;
|
||||
create table t1 (a varchar(255) character set utf8,
|
||||
b varchar(255) character set utf8,
|
||||
c varchar(255) character set utf8,
|
||||
d varchar(255) character set utf8,
|
||||
e varchar(255) character set utf8,
|
||||
key (a,b,c,d,e)) engine=innodb;
|
||||
ERROR 42000: Specified key was too long; max key length is 3072 bytes
|
||||
create table t1 (s1 varbinary(2),primary key (s1)) engine=innodb;
|
||||
create table t2 (s1 binary(2),primary key (s1)) engine=innodb;
|
||||
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' for key 'PRIMARY'
|
||||
insert into t2 values (0x41),(0x4120);
|
||||
insert into t3 values (0x41),(0x4120),(0x4100);
|
||||
ERROR 23000: Duplicate entry 'A ' for key 'PRIMARY'
|
||||
insert into t3 values (0x41),(0x4100);
|
||||
insert into t4 values (0x41),(0x4120),(0x4100);
|
||||
ERROR 23000: Duplicate entry 'A' for key 'PRIMARY'
|
||||
insert into t4 values (0x41),(0x4100);
|
||||
select hex(s1) from t1;
|
||||
hex(s1)
|
||||
41
|
||||
4100
|
||||
4120
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
4100
|
||||
4120
|
||||
select hex(s1) from t3;
|
||||
hex(s1)
|
||||
4100
|
||||
41
|
||||
select hex(s1) from t4;
|
||||
hex(s1)
|
||||
4100
|
||||
41
|
||||
drop table t1,t2,t3,t4;
|
||||
create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=innodb;
|
||||
create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
|
||||
insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42);
|
||||
insert into t2 values(0x42);
|
||||
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
|
||||
insert into t2 values(0x41);
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
4100
|
||||
update t1 set s1=0x123456 where a=2;
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
4100
|
||||
update t1 set s1=0x12 where a=1;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
|
||||
update t1 set s1=0x12345678 where a=1;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
|
||||
update t1 set s1=0x123457 where a=1;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
|
||||
update t1 set s1=0x1220 where a=1;
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
1220
|
||||
update t1 set s1=0x1200 where a=1;
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
1200
|
||||
update t1 set s1=0x4200 where a=1;
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
4200
|
||||
delete from t1 where a=1;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
|
||||
delete from t1 where a=2;
|
||||
update t2 set s1=0x4120;
|
||||
delete from t1;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
|
||||
delete from t1 where a!=3;
|
||||
select a,hex(s1) from t1;
|
||||
a hex(s1)
|
||||
3 4120
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
4120
|
||||
drop table t2,t1;
|
||||
create table t1 (a int primary key,s1 varchar(2) binary not null unique) engine=innodb;
|
||||
create table t2 (s1 char(2) binary not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
|
||||
insert into t1 values(1,0x4100),(2,0x41);
|
||||
insert into t2 values(0x41);
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
41
|
||||
update t1 set s1=0x1234 where a=1;
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
41
|
||||
update t1 set s1=0x12 where a=2;
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
12
|
||||
delete from t1 where a=1;
|
||||
delete from t1 where a=2;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
|
||||
select a,hex(s1) from t1;
|
||||
a hex(s1)
|
||||
2 12
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
12
|
||||
drop table t2,t1;
|
||||
CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB;
|
||||
CREATE TABLE t2(a INT) ENGINE=InnoDB;
|
||||
ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a);
|
||||
ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1;
|
||||
ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a);
|
||||
ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
KEY `t2_ibfk_0` (`a`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
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);
|
||||
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),
|
||||
(12),(22),(32),(42),(52),(62),(72),(82),(92),(102),
|
||||
(13),(23),(33),(43),(53),(63),(73),(83),(93),(103),
|
||||
(14),(24),(34),(44),(54),(64),(74),(84),(94),(104);
|
||||
commit;
|
||||
commit;
|
||||
drop trigger t1t;
|
||||
drop table t1;
|
||||
create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
|
||||
create table t2(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
|
||||
create table t3(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
|
||||
create table t4(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
|
||||
create table t5(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
|
||||
insert into t1(a) values (1),(2),(3);
|
||||
insert into t2(a) values (1),(2),(3);
|
||||
insert into t3(a) values (1),(2),(3);
|
||||
insert into t4(a) values (1),(2),(3);
|
||||
insert into t3(a) values (5),(7),(8);
|
||||
insert into t4(a) values (5),(7),(8);
|
||||
insert into t5(a) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12);
|
||||
create trigger t1t before insert on t1 for each row begin
|
||||
INSERT INTO t2 SET a = NEW.a;
|
||||
end |
|
||||
create trigger t2t before insert on t2 for each row begin
|
||||
DELETE FROM t3 WHERE a = NEW.a;
|
||||
end |
|
||||
create trigger t3t before delete on t3 for each row begin
|
||||
UPDATE t4 SET b = b + 1 WHERE a = OLD.a;
|
||||
end |
|
||||
create trigger t4t before update on t4 for each row begin
|
||||
UPDATE t5 SET b = b + 1 where a = NEW.a;
|
||||
end |
|
||||
commit;
|
||||
set autocommit = 0;
|
||||
update t1 set b = b + 5 where a = 1;
|
||||
update t2 set b = b + 5 where a = 1;
|
||||
update t3 set b = b + 5 where a = 1;
|
||||
update t4 set b = b + 5 where a = 1;
|
||||
insert into t5(a) values(20);
|
||||
set autocommit = 0;
|
||||
insert into t1(a) values(7);
|
||||
insert into t2(a) values(8);
|
||||
delete from t2 where a = 3;
|
||||
update t4 set b = b + 1 where a = 3;
|
||||
commit;
|
||||
drop trigger t1t;
|
||||
drop trigger t2t;
|
||||
drop trigger t3t;
|
||||
drop trigger t4t;
|
||||
drop table t1, t2, t3, t4, t5;
|
||||
CREATE TABLE t1 (
|
||||
field1 varchar(8) NOT NULL DEFAULT '',
|
||||
field2 varchar(8) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (field1, field2)
|
||||
) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (
|
||||
field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY,
|
||||
FOREIGN KEY (field1) REFERENCES t1 (field1)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES ('old', 'somevalu');
|
||||
INSERT INTO t1 VALUES ('other', 'anyvalue');
|
||||
INSERT INTO t2 VALUES ('old');
|
||||
INSERT INTO t2 VALUES ('other');
|
||||
UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu';
|
||||
ERROR 23000: Upholding foreign key constraints for table 't1', entry 'other-somevalu', key 1 would lead to a duplicate entry
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
create table t1 (
|
||||
c1 bigint not null,
|
||||
c2 bigint not null,
|
||||
primary key (c1),
|
||||
unique key (c2)
|
||||
) engine=innodb;
|
||||
create table t2 (
|
||||
c1 bigint not null,
|
||||
primary key (c1)
|
||||
) engine=innodb;
|
||||
alter table t1 add constraint c2_fk foreign key (c2)
|
||||
references t2(c1) on delete cascade;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` bigint(20) NOT NULL,
|
||||
`c2` bigint(20) NOT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
UNIQUE KEY `c2` (`c2`),
|
||||
CONSTRAINT `c2_fk` FOREIGN KEY (`c2`) REFERENCES `t2` (`c1`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
alter table t1 drop foreign key c2_fk;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` bigint(20) NOT NULL,
|
||||
`c2` bigint(20) NOT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
UNIQUE KEY `c2` (`c2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
drop table t1, t2;
|
||||
create table t1(a date) engine=innodb;
|
||||
create table t2(a date, key(a)) engine=innodb;
|
||||
insert into t1 values('2005-10-01');
|
||||
insert into t2 values('2005-10-01');
|
||||
select * from t1, t2
|
||||
where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
|
||||
a a
|
||||
2005-10-01 2005-10-01
|
||||
drop table t1, t2;
|
||||
create table t1 (id int not null, f_id int not null, f int not null,
|
||||
primary key(f_id, id)) engine=innodb;
|
||||
create table t2 (id int not null,s_id int not null,s varchar(200),
|
||||
primary key(id)) engine=innodb;
|
||||
INSERT INTO t1 VALUES (8, 1, 3);
|
||||
INSERT INTO t1 VALUES (1, 2, 1);
|
||||
INSERT INTO t2 VALUES (1, 0, '');
|
||||
INSERT INTO t2 VALUES (8, 1, '');
|
||||
commit;
|
||||
DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id)
|
||||
WHERE mm.id IS NULL;
|
||||
select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
|
||||
where mm.id is null lock in share mode;
|
||||
id f_id f
|
||||
drop table t1,t2;
|
||||
create table t1(a int not null, b int, primary key(a)) engine=innodb;
|
||||
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
|
||||
commit;
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
update t1 set b = 5 where b = 1;
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
select * from t1 where a = 7 and b = 3 for update;
|
||||
a b
|
||||
7 3
|
||||
commit;
|
||||
commit;
|
||||
drop table t1;
|
||||
create table t1(a int not null, b int, primary key(a)) engine=innodb;
|
||||
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2);
|
||||
commit;
|
||||
set autocommit = 0;
|
||||
select * from t1 lock in share mode;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 1
|
||||
4 2
|
||||
5 1
|
||||
6 2
|
||||
update t1 set b = 5 where b = 1;
|
||||
set autocommit = 0;
|
||||
select * from t1 where a = 2 and b = 2 for update;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
commit;
|
||||
commit;
|
||||
drop table t1;
|
||||
create table t1(a int not null, b int, primary key(a)) engine=innodb;
|
||||
insert into t1 values (1,2),(5,3),(4,2);
|
||||
create table t2(d int not null, e int, primary key(d)) engine=innodb;
|
||||
insert into t2 values (8,6),(12,1),(3,1);
|
||||
commit;
|
||||
set autocommit = 0;
|
||||
select * from t2 for update;
|
||||
d e
|
||||
3 1
|
||||
8 6
|
||||
12 1
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
insert into t1 select * from t2;
|
||||
update t1 set b = (select e from t2 where a = d);
|
||||
create table t3(d int not null, e int, primary key(d)) engine=innodb
|
||||
select * from t2;
|
||||
commit;
|
||||
commit;
|
||||
drop table t1, t2, t3;
|
||||
create table t1(a int not null, b int, primary key(a)) engine=innodb;
|
||||
insert into t1 values (1,2),(5,3),(4,2);
|
||||
create table t2(a int not null, b int, primary key(a)) engine=innodb;
|
||||
insert into t2 values (8,6),(12,1),(3,1);
|
||||
create table t3(d int not null, b int, primary key(d)) engine=innodb;
|
||||
insert into t3 values (8,6),(12,1),(3,1);
|
||||
create table t5(a int not null, b int, primary key(a)) engine=innodb;
|
||||
insert into t5 values (1,2),(5,3),(4,2);
|
||||
create table t6(d int not null, e int, primary key(d)) engine=innodb;
|
||||
insert into t6 values (8,6),(12,1),(3,1);
|
||||
create table t8(a int not null, b int, primary key(a)) engine=innodb;
|
||||
insert into t8 values (1,2),(5,3),(4,2);
|
||||
create table t9(d int not null, e int, primary key(d)) engine=innodb;
|
||||
insert into t9 values (8,6),(12,1),(3,1);
|
||||
commit;
|
||||
set autocommit = 0;
|
||||
select * from t2 for update;
|
||||
a b
|
||||
3 1
|
||||
8 6
|
||||
12 1
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
insert into t1 select * from t2;
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
update t3 set b = (select b from t2 where a = d);
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2;
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
insert into t5 (select * from t2 lock in share mode);
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
update t6 set e = (select b from t2 where a = d lock in share mode);
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode;
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
insert into t8 (select * from t2 for update);
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
update t9 set e = (select b from t2 where a = d for update);
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
commit;
|
||||
drop table t1, t2, t3, t5, t6, t8, t9;
|
||||
CREATE TABLE t1 (DB_ROW_ID int) engine=innodb;
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: -1)
|
||||
CREATE TABLE t1 (
|
||||
a BIGINT(20) NOT NULL,
|
||||
PRIMARY KEY (a)
|
||||
) ENGINE=INNODB DEFAULT CHARSET=UTF8;
|
||||
CREATE TABLE t2 (
|
||||
a BIGINT(20) NOT NULL,
|
||||
b VARCHAR(128) NOT NULL,
|
||||
c TEXT NOT NULL,
|
||||
PRIMARY KEY (a,b),
|
||||
KEY idx_t2_b_c (b,c(200)),
|
||||
CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a)
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=INNODB DEFAULT CHARSET=UTF8;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t2 VALUES (1, 'bar', 'vbar');
|
||||
INSERT INTO t2 VALUES (1, 'BAR2', 'VBAR');
|
||||
INSERT INTO t2 VALUES (1, 'bar_bar', 'bibi');
|
||||
INSERT INTO t2 VALUES (1, 'customer_over', '1');
|
||||
SELECT * FROM t2 WHERE b = 'customer_over';
|
||||
a b c
|
||||
1 customer_over 1
|
||||
SELECT * FROM t2 WHERE BINARY b = 'customer_over';
|
||||
a b c
|
||||
1 customer_over 1
|
||||
SELECT DISTINCT p0.a FROM t2 p0 WHERE p0.b = 'customer_over';
|
||||
a
|
||||
1
|
||||
/* Bang: Empty result set, above was expected: */
|
||||
SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
|
||||
a
|
||||
1
|
||||
SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
|
||||
a
|
||||
1
|
||||
drop table t2, t1;
|
||||
CREATE TABLE t1 ( a int ) ENGINE=innodb;
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
OPTIMIZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t1 optimize status OK
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id int PRIMARY KEY, f int NOT NULL, INDEX(f)) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (id int PRIMARY KEY, f INT NOT NULL,
|
||||
CONSTRAINT t2_t1 FOREIGN KEY (id) REFERENCES t1 (id)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB;
|
||||
ALTER TABLE t2 ADD FOREIGN KEY (f) REFERENCES t1 (f) ON
|
||||
DELETE CASCADE ON UPDATE CASCADE;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`id` int(11) NOT NULL,
|
||||
`f` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `f` (`f`),
|
||||
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f`) REFERENCES `t1` (`f`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `t2_t1` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2, t1;
|
||||
CREATE TABLE t1 (a INT, INDEX(a)) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t2 VALUES (1);
|
||||
ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL;
|
||||
ALTER TABLE t2 MODIFY a INT NOT NULL;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
|
||||
DELETE FROM t1;
|
||||
DROP TABLE t2,t1;
|
||||
CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY)
|
||||
ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (0xEFBCA4EFBCA4EFBCA4);
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES ('DDD');
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
DDD
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id int PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB
|
||||
AUTO_INCREMENT=42;
|
||||
INSERT INTO t1 VALUES (0),(347),(0);
|
||||
SELECT * FROM t1;
|
||||
id
|
||||
42
|
||||
347
|
||||
348
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1
|
||||
CREATE TABLE t2 (id int PRIMARY KEY) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES(42),(347),(348);
|
||||
ALTER TABLE t1 ADD CONSTRAINT t1_t2 FOREIGN KEY (id) REFERENCES t2(id);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `t1_t2` FOREIGN KEY (`id`) REFERENCES `t2` (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (
|
||||
c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255),
|
||||
c05 CHAR(255), c06 CHAR(255), c07 CHAR(255), c08 CHAR(255),
|
||||
c09 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255),
|
||||
c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255),
|
||||
c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255),
|
||||
c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255),
|
||||
c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255),
|
||||
c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255)
|
||||
) ENGINE = InnoDB;
|
||||
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
|
||||
DROP TABLE IF EXISTS t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
CREATE TABLE t1(
|
||||
id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(-10);
|
||||
SELECT * FROM t1;
|
||||
id
|
||||
-10
|
||||
INSERT INTO t1 VALUES(NULL);
|
||||
SELECT * FROM t1;
|
||||
id
|
||||
-10
|
||||
1
|
||||
DROP TABLE t1;
|
||||
SET binlog_format='MIXED';
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
Note 1051 Unknown table 't2'
|
||||
CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SELECT * FROM t2;
|
||||
a
|
||||
SET binlog_format='MIXED';
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
COMMIT;
|
||||
SELECT * FROM t1 WHERE a=1;
|
||||
a
|
||||
1
|
||||
SET binlog_format='MIXED';
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
SELECT * FROM t2;
|
||||
a
|
||||
SET binlog_format='MIXED';
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
INSERT INTO t1 VALUES (2);
|
||||
COMMIT;
|
||||
SELECT * FROM t1 WHERE a=2;
|
||||
a
|
||||
2
|
||||
SELECT * FROM t1 WHERE a=2;
|
||||
a
|
||||
2
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
create table t1 (i int, j int) engine=innodb;
|
||||
insert into t1 (i, j) values (1, 1), (2, 2);
|
||||
update t1 set j = 2;
|
||||
affected rows: 1
|
||||
info: Rows matched: 2 Changed: 1 Warnings: 0
|
||||
drop table t1;
|
||||
create table t1 (id int) comment='this is a comment' engine=innodb;
|
||||
select table_comment, data_free > 0 as data_free_is_set
|
||||
from information_schema.tables
|
||||
where table_schema='test' and table_name = 't1';
|
||||
table_comment data_free_is_set
|
||||
this is a comment 1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
c2 VARCHAR(128) NOT NULL,
|
||||
PRIMARY KEY(c1)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=100;
|
||||
CREATE TABLE t2 (
|
||||
c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
c2 INT(10) UNSIGNED DEFAULT NULL,
|
||||
PRIMARY KEY(c1)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=200;
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2';
|
||||
AUTO_INCREMENT
|
||||
200
|
||||
ALTER TABLE t2 ADD CONSTRAINT t1_t2_1 FOREIGN KEY(c1) REFERENCES t1(c1);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2';
|
||||
AUTO_INCREMENT
|
||||
200
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 int default NULL,
|
||||
c2 int default NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
TRUNCATE TABLE t1;
|
||||
affected rows: 0
|
||||
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
|
||||
affected rows: 5
|
||||
info: Records: 5 Duplicates: 0 Warnings: 0
|
||||
TRUNCATE TABLE t1;
|
||||
affected rows: 0
|
||||
DROP TABLE t1;
|
||||
Variable_name Value
|
||||
Handler_update 0
|
||||
Variable_name Value
|
||||
Handler_delete 0
|
||||
Variable_name Value
|
||||
Handler_update 1
|
||||
Variable_name Value
|
||||
Handler_delete 1
|
@@ -1 +1,12 @@
|
||||
innodb-index: InnoDB: Error: table `test`.`t1#1` already exists in InnoDB internal
|
||||
##############################################################################
|
||||
#
|
||||
# List the test cases that are to be disabled temporarily.
|
||||
#
|
||||
# Separate the test case name and the comment with ':'.
|
||||
#
|
||||
# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
|
||||
#
|
||||
# Do not use any TAB characters for whitespace.
|
||||
#
|
||||
##############################################################################
|
||||
innodb : Bug#53306 2010-04-30 VasilDimov valgrind warnings
|
||||
|
@@ -25,7 +25,7 @@ SELECT * FROM t1;
|
||||
# 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. Also, see http://bugs.mysql.com/bug.php?id=47621.
|
||||
-- error ER_AUTOINC_READ_FAILED,1467
|
||||
#-- error ER_AUTOINC_READ_FAILED,1467
|
||||
INSERT INTO t1 VALUES(null);
|
||||
ALTER TABLE t1 AUTO_INCREMENT = 3;
|
||||
SHOW CREATE TABLE t1;
|
@@ -1 +0,0 @@
|
||||
--loose-innodb_lock_wait_timeout=2
|
@@ -1,5 +0,0 @@
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_ucs2.inc
|
||||
|
||||
-- let charset = ucs2
|
||||
-- source suite/innodb/include/innodb-index.inc
|
@@ -1,2 +0,0 @@
|
||||
--loose-innodb-use-sys-malloc=true
|
||||
--loose-innodb-use-sys-malloc=true
|
1414
mysql-test/suite/innodb/t/innodb.test
Normal file
1414
mysql-test/suite/innodb/t/innodb.test
Normal file
File diff suppressed because it is too large
Load Diff
43
mysql-test/suite/innodb/t/innodb_bug51920.test
Normal file
43
mysql-test/suite/innodb/t/innodb_bug51920.test
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# Bug #51920: InnoDB connections in lock wait ignore KILL until timeout
|
||||
#
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
CREATE TABLE bug51920 (i INT) ENGINE=InnoDB;
|
||||
INSERT INTO bug51920 VALUES (1);
|
||||
|
||||
BEGIN;
|
||||
SELECT * FROM bug51920 FOR UPDATE;
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
|
||||
connection con1;
|
||||
--send
|
||||
UPDATE bug51920 SET i=2;
|
||||
|
||||
connection default;
|
||||
let $wait_condition =
|
||||
SELECT COUNT(*)=1 FROM information_schema.processlist
|
||||
WHERE INFO="UPDATE bug51920 SET i=2";
|
||||
-- source include/wait_condition.inc
|
||||
|
||||
SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
|
||||
WHERE INFO="UPDATE bug51920 SET i=2"
|
||||
INTO @thread_id;
|
||||
|
||||
KILL @thread_id;
|
||||
let $wait_condition =
|
||||
SELECT COUNT(*)=0 FROM information_schema.processlist WHERE ID=@thread_id;
|
||||
-- source include/wait_condition.inc
|
||||
|
||||
#
|
||||
# Bug#19723: kill of active connection yields different error code
|
||||
# depending on platform.
|
||||
#
|
||||
connection con1;
|
||||
-- error 1317, 2006, 2013
|
||||
reap;
|
||||
connection default;
|
||||
DROP TABLE bug51920;
|
||||
-- disconnect con1
|
1
mysql-test/suite/innodb/t/innodb_bug52663-master.opt
Normal file
1
mysql-test/suite/innodb/t/innodb_bug52663-master.opt
Normal file
@@ -0,0 +1 @@
|
||||
--innodb_lock_wait_timeout=1
|
34
mysql-test/suite/innodb/t/innodb_bug52663.test
Normal file
34
mysql-test/suite/innodb/t/innodb_bug52663.test
Normal file
@@ -0,0 +1,34 @@
|
||||
--source include/have_innodb.inc
|
||||
|
||||
set session transaction isolation level read committed;
|
||||
|
||||
create table innodb_bug52663 (what varchar(5), id integer, count integer, primary key
|
||||
(what, id)) engine=innodb;
|
||||
insert into innodb_bug52663 values ('total', 0, 0);
|
||||
begin;
|
||||
|
||||
connect (addconroot, localhost, root,,);
|
||||
connection addconroot;
|
||||
set session transaction isolation level read committed;
|
||||
begin;
|
||||
|
||||
connection default;
|
||||
update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
|
||||
select * from innodb_bug52663;
|
||||
|
||||
connection addconroot;
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
|
||||
select * from innodb_bug52663;
|
||||
|
||||
connection default;
|
||||
commit;
|
||||
|
||||
connection addconroot;
|
||||
update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
|
||||
commit;
|
||||
select * from innodb_bug52663;
|
||||
|
||||
connection default;
|
||||
select * from innodb_bug52663;
|
||||
drop table innodb_bug52663;
|
1
mysql-test/suite/innodb/t/innodb_misc1-master.opt
Normal file
1
mysql-test/suite/innodb/t/innodb_misc1-master.opt
Normal file
@@ -0,0 +1 @@
|
||||
--binlog_cache_size=32768 --innodb_lock_wait_timeout=1
|
1206
mysql-test/suite/innodb/t/innodb_misc1.test
Normal file
1206
mysql-test/suite/innodb/t/innodb_misc1.test
Normal file
File diff suppressed because it is too large
Load Diff
21
mysql-test/suite/innodb_plugin/include/ctype_innodb_like.inc
Normal file
21
mysql-test/suite/innodb_plugin/include/ctype_innodb_like.inc
Normal file
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# 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;
|
51
mysql-test/suite/innodb_plugin/include/innodb_trx_weight.inc
Normal file
51
mysql-test/suite/innodb_plugin/include/innodb_trx_weight.inc
Normal file
@@ -0,0 +1,51 @@
|
||||
-- connect (con1,localhost,root,,)
|
||||
-- connect (con2,localhost,root,,)
|
||||
|
||||
-- connection con1
|
||||
SET autocommit=0;
|
||||
SELECT * FROM t1 FOR UPDATE;
|
||||
-- if ($con1_extra_sql_present) {
|
||||
-- eval $con1_extra_sql
|
||||
-- }
|
||||
|
||||
-- connection con2
|
||||
SET autocommit=0;
|
||||
SELECT * FROM t2 FOR UPDATE;
|
||||
-- if ($con2_extra_sql_present) {
|
||||
-- eval $con2_extra_sql
|
||||
-- }
|
||||
|
||||
-- if ($con1_should_be_rolledback) {
|
||||
-- connection con1
|
||||
-- send
|
||||
INSERT INTO t2 VALUES (0);
|
||||
|
||||
-- connection con2
|
||||
INSERT INTO t1 VALUES (0);
|
||||
ROLLBACK;
|
||||
|
||||
-- connection con1
|
||||
-- error ER_LOCK_DEADLOCK
|
||||
-- reap
|
||||
-- }
|
||||
# else
|
||||
-- if (!$con1_should_be_rolledback) {
|
||||
-- connection con2
|
||||
-- send
|
||||
INSERT INTO t1 VALUES (0);
|
||||
|
||||
-- connection con1
|
||||
INSERT INTO t2 VALUES (0);
|
||||
ROLLBACK;
|
||||
|
||||
-- connection con2
|
||||
-- error ER_LOCK_DEADLOCK
|
||||
-- reap
|
||||
-- }
|
||||
|
||||
-- connection default
|
||||
|
||||
DELETE FROM t5_nontrans;
|
||||
|
||||
-- disconnect con1
|
||||
-- disconnect con2
|
30
mysql-test/suite/innodb_plugin/r/innodb-autoinc-44030.result
Normal file
30
mysql-test/suite/innodb_plugin/r/innodb-autoinc-44030.result
Normal file
@@ -0,0 +1,30 @@
|
||||
drop table if exists t1;
|
||||
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);
|
||||
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);
|
||||
SELECT * FROM t1;
|
||||
d1
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
DROP TABLE t1;
|
1246
mysql-test/suite/innodb_plugin/r/innodb-autoinc.result
Normal file
1246
mysql-test/suite/innodb_plugin/r/innodb-autoinc.result
Normal file
File diff suppressed because it is too large
Load Diff
57
mysql-test/suite/innodb_plugin/r/innodb-lock.result
Normal file
57
mysql-test/suite/innodb_plugin/r/innodb-lock.result
Normal file
@@ -0,0 +1,57 @@
|
||||
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;
|
13
mysql-test/suite/innodb_plugin/r/innodb-replace.result
Normal file
13
mysql-test/suite/innodb_plugin/r/innodb-replace.result
Normal file
@@ -0,0 +1,13 @@
|
||||
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;
|
@@ -0,0 +1,47 @@
|
||||
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;
|
@@ -692,6 +692,8 @@ 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);
|
||||
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 +701,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
|
||||
@@ -1508,7 +1513,7 @@ t2 CREATE TABLE `t2` (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
drop index id2 on t2;
|
||||
drop index id on t2;
|
||||
Got one of the listed errors
|
||||
ERROR HY000: Cannot drop index 'id': needed in a foreign key constraint
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
@@ -1738,7 +1743,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
|
||||
@@ -1747,7 +1752,7 @@ variable_value - @innodb_rows_deleted_orig
|
||||
71
|
||||
SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
|
||||
variable_value - @innodb_rows_inserted_orig
|
||||
1084
|
||||
1087
|
||||
SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
|
||||
variable_value - @innodb_rows_updated_orig
|
||||
885
|
||||
@@ -1766,9 +1771,10 @@ variable_value - @innodb_row_lock_time_max_orig
|
||||
SELECT variable_value - @innodb_row_lock_time_avg_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg';
|
||||
variable_value - @innodb_row_lock_time_avg_orig
|
||||
0
|
||||
SET @innodb_sync_spin_loops_orig = @@innodb_sync_spin_loops;
|
||||
show variables like "innodb_sync_spin_loops";
|
||||
Variable_name Value
|
||||
innodb_sync_spin_loops 20
|
||||
innodb_sync_spin_loops 30
|
||||
set global innodb_sync_spin_loops=1000;
|
||||
show variables like "innodb_sync_spin_loops";
|
||||
Variable_name Value
|
||||
@@ -1781,10 +1787,10 @@ set global innodb_sync_spin_loops=20;
|
||||
show variables like "innodb_sync_spin_loops";
|
||||
Variable_name Value
|
||||
innodb_sync_spin_loops 20
|
||||
SET @old_innodb_thread_concurrency= @@global.innodb_thread_concurrency;
|
||||
set global innodb_sync_spin_loops=@innodb_sync_spin_loops_orig;
|
||||
show variables like "innodb_thread_concurrency";
|
||||
Variable_name Value
|
||||
innodb_thread_concurrency 8
|
||||
innodb_thread_concurrency 0
|
||||
set global innodb_thread_concurrency=1001;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect thread_concurrency value: '1001'
|
||||
@@ -1799,7 +1805,6 @@ set global innodb_thread_concurrency=16;
|
||||
show variables like "innodb_thread_concurrency";
|
||||
Variable_name Value
|
||||
innodb_thread_concurrency 16
|
||||
SET @@global.innodb_thread_concurrency= @old_innodb_thread_concurrency;
|
||||
show variables like "innodb_concurrency_tickets";
|
||||
Variable_name Value
|
||||
innodb_concurrency_tickets 500
|
||||
@@ -1833,6 +1838,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 ---
|
||||
@@ -2377,6 +2383,8 @@ t1 CREATE TABLE `t1` (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 (v varchar(10), c char(10)) row_format=fixed;
|
||||
Warnings:
|
||||
Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
@@ -2404,6 +2412,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
|
||||
@@ -3086,7 +3095,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
commit;
|
||||
drop table t1, t2, t3, t5, t6, t8, t9;
|
||||
CREATE TABLE t1 (DB_ROW_ID int) engine=innodb;
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: -1)
|
||||
ERROR 42000: Incorrect column name 'DB_ROW_ID'
|
||||
CREATE TABLE t1 (
|
||||
a BIGINT(20) NOT NULL,
|
||||
PRIMARY KEY (a)
|
||||
@@ -3190,6 +3199,7 @@ t1 CREATE TABLE `t1` (
|
||||
CONSTRAINT `t1_t2` FOREIGN KEY (`id`) REFERENCES `t2` (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1,t2;
|
||||
set innodb_strict_mode=on;
|
||||
CREATE TABLE t1 (
|
||||
c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255),
|
||||
c05 CHAR(255), c06 CHAR(255), c07 CHAR(255), c08 CHAR(255),
|
55
mysql-test/suite/innodb_plugin/r/innodb_bug21704.result
Normal file
55
mysql-test/suite/innodb_plugin/r/innodb_bug21704.result
Normal file
@@ -0,0 +1,55 @@
|
||||
#
|
||||
# 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;
|
4
mysql-test/suite/innodb_plugin/r/innodb_bug34300.result
Normal file
4
mysql-test/suite/innodb_plugin/r/innodb_bug34300.result
Normal file
@@ -0,0 +1,4 @@
|
||||
f4 f8
|
||||
xxx zzz
|
||||
f4 f8
|
||||
xxx zzz
|
1
mysql-test/suite/innodb_plugin/r/innodb_bug35220.result
Normal file
1
mysql-test/suite/innodb_plugin/r/innodb_bug35220.result
Normal file
@@ -0,0 +1 @@
|
||||
SET storage_engine=InnoDB;
|
1
mysql-test/suite/innodb_plugin/r/innodb_bug36172.result
Normal file
1
mysql-test/suite/innodb_plugin/r/innodb_bug36172.result
Normal file
@@ -0,0 +1 @@
|
||||
SET storage_engine=InnoDB;
|
11
mysql-test/suite/innodb_plugin/r/innodb_bug38231.result
Normal file
11
mysql-test/suite/innodb_plugin/r/innodb_bug38231.result
Normal file
@@ -0,0 +1,11 @@
|
||||
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
mysql-test/suite/innodb_plugin/r/innodb_bug39438.result
Normal file
1
mysql-test/suite/innodb_plugin/r/innodb_bug39438.result
Normal file
@@ -0,0 +1 @@
|
||||
SET storage_engine=InnoDB;
|
9
mysql-test/suite/innodb_plugin/r/innodb_bug40565.result
Normal file
9
mysql-test/suite/innodb_plugin/r/innodb_bug40565.result
Normal file
@@ -0,0 +1,9 @@
|
||||
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;
|
@@ -0,0 +1,26 @@
|
||||
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
|
22
mysql-test/suite/innodb_plugin/r/innodb_bug42101.result
Normal file
22
mysql-test/suite/innodb_plugin/r/innodb_bug42101.result
Normal file
@@ -0,0 +1,22 @@
|
||||
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
|
6
mysql-test/suite/innodb_plugin/r/innodb_bug44369.result
Normal file
6
mysql-test/suite/innodb_plugin/r/innodb_bug44369.result
Normal file
@@ -0,0 +1,6 @@
|
||||
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'
|
7
mysql-test/suite/innodb_plugin/r/innodb_bug45357.result
Normal file
7
mysql-test/suite/innodb_plugin/r/innodb_bug45357.result
Normal file
@@ -0,0 +1,7 @@
|
||||
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;
|
19
mysql-test/suite/innodb_plugin/r/innodb_bug46000.result
Normal file
19
mysql-test/suite/innodb_plugin/r/innodb_bug46000.result
Normal file
@@ -0,0 +1,19 @@
|
||||
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;
|
21
mysql-test/suite/innodb_plugin/r/innodb_bug47621.result
Normal file
21
mysql-test/suite/innodb_plugin/r/innodb_bug47621.result
Normal file
@@ -0,0 +1,21 @@
|
||||
CREATE TABLE bug47621 (salesperson INT) ENGINE=InnoDB;
|
||||
ALTER TABLE bug47621 CHANGE salesperson sales_acct_id INT;
|
||||
create index orgs on bug47621(sales_acct_id);
|
||||
ALTER TABLE bug47621 CHANGE sales_acct_id salesperson INT;
|
||||
drop table bug47621;
|
||||
CREATE TABLE bug47621_sale (
|
||||
salesperson INT,
|
||||
PRIMARY KEY(salesperson)) engine = innodb;
|
||||
CREATE TABLE bug47621_shirt(
|
||||
id SMALLINT,
|
||||
owner INT,
|
||||
FOREIGN KEY(owner)
|
||||
references bug47621_sale(salesperson) ON DELETE RESTRICT)
|
||||
engine = innodb;
|
||||
insert into bug47621_sale values(9);
|
||||
insert into bug47621_shirt values(1, 9);
|
||||
ALTER TABLE bug47621_shirt CHANGE id new_id INT;
|
||||
drop table bug47621_shirt;
|
||||
ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT;
|
||||
ALTER TABLE bug47621_sale ADD INDEX idx (sales_acct_id);
|
||||
drop table bug47621_sale;
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user