mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge with MySQL 5.1.60
This commit is contained in:
5
mysql-test/include/have_federated_plugin.inc
Normal file
5
mysql-test/include/have_federated_plugin.inc
Normal file
@ -0,0 +1,5 @@
|
||||
if (`select plugin_library IS NULL from information_schema.plugins where plugin_name LIKE '%federated%'`)
|
||||
{
|
||||
--skip federated plugin not available
|
||||
}
|
||||
|
@ -225,8 +225,11 @@ sub collect_test_cases ($$$) {
|
||||
sub split_testname {
|
||||
my ($test_name)= @_;
|
||||
|
||||
# Get rid of directory part and split name on .'s
|
||||
my @parts= split(/\./, basename($test_name));
|
||||
# If .test file name is used, get rid of directory part
|
||||
$test_name= basename($test_name) if $test_name =~ /\.test$/;
|
||||
|
||||
# Now split name on .'s
|
||||
my @parts= split(/\./, $test_name);
|
||||
|
||||
if (@parts == 1){
|
||||
# Only testname given, ex: alias
|
||||
|
@ -2096,6 +2096,79 @@ sub environment_setup {
|
||||
push(@ld_library_paths, "$basedir/storage/ndb/src/.libs");
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Add the path where mysqld will find udf_example.so
|
||||
# --------------------------------------------------------------------------
|
||||
my $lib_udf_example=
|
||||
mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
|
||||
"$basedir/sql/.libs/udf_example.so",);
|
||||
|
||||
if ( $lib_udf_example )
|
||||
{
|
||||
push(@ld_library_paths, dirname($lib_udf_example));
|
||||
}
|
||||
|
||||
$ENV{'UDF_EXAMPLE_LIB'}=
|
||||
($lib_udf_example ? basename($lib_udf_example) : "");
|
||||
$ENV{'UDF_EXAMPLE_LIB_OPT'}= "--plugin-dir=".
|
||||
($lib_udf_example ? dirname($lib_udf_example) : "");
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Add the path where mysqld will find ha_example.so
|
||||
# --------------------------------------------------------------------------
|
||||
if ($mysql_version_id >= 50100) {
|
||||
my $plugin_filename;
|
||||
if (IS_WINDOWS)
|
||||
{
|
||||
$plugin_filename = "ha_example.dll";
|
||||
}
|
||||
else
|
||||
{
|
||||
$plugin_filename = "ha_example.so";
|
||||
}
|
||||
my $lib_example_plugin=
|
||||
mtr_file_exists(vs_config_dirs('storage/example',$plugin_filename),
|
||||
"$basedir/storage/example/.libs/".$plugin_filename,
|
||||
"$basedir/lib/mysql/plugin/".$plugin_filename);
|
||||
$ENV{'EXAMPLE_PLUGIN'}=
|
||||
($lib_example_plugin ? basename($lib_example_plugin) : "");
|
||||
$ENV{'EXAMPLE_PLUGIN_OPT'}= "--plugin-dir=".
|
||||
($lib_example_plugin ? dirname($lib_example_plugin) : "");
|
||||
|
||||
$ENV{'HA_EXAMPLE_SO'}="'".$plugin_filename."'";
|
||||
$ENV{'EXAMPLE_PLUGIN_LOAD'}="--plugin_load=EXAMPLE=".$plugin_filename;
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Add the path where mysqld will find ha_federated.so
|
||||
# --------------------------------------------------------------------------
|
||||
my $fedplug_filename;
|
||||
if (IS_WINDOWS) {
|
||||
$fedplug_filename = "ha_federated.dll";
|
||||
} else {
|
||||
$fedplug_filename = "ha_federated.so";
|
||||
}
|
||||
my $lib_fed_plugin=
|
||||
mtr_file_exists(vs_config_dirs('storage/federated',$fedplug_filename),
|
||||
"$basedir/storage/federated/.libs/".$fedplug_filename,
|
||||
"$basedir/lib/mysql/plugin/".$fedplug_filename);
|
||||
|
||||
$ENV{'FEDERATED_PLUGIN'}= $fedplug_filename;
|
||||
$ENV{'FEDERATED_PLUGIN_DIR'}=
|
||||
($lib_fed_plugin ? dirname($lib_fed_plugin) : "");
|
||||
|
||||
# ----------------------------------------------------
|
||||
# Add the path where mysqld will find mypluglib.so
|
||||
# ----------------------------------------------------
|
||||
my $lib_simple_parser=
|
||||
mtr_file_exists(vs_config_dirs('plugin/fulltext', 'mypluglib.dll'),
|
||||
"$basedir/plugin/fulltext/.libs/mypluglib.so",);
|
||||
|
||||
$ENV{'SIMPLE_PARSER'}=
|
||||
($lib_simple_parser ? basename($lib_simple_parser) : "");
|
||||
$ENV{'SIMPLE_PARSER_OPT'}= "--plugin-dir=".
|
||||
($lib_simple_parser ? dirname($lib_simple_parser) : "");
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Valgrind need to be run with debug libraries otherwise it's almost
|
||||
# impossible to add correct supressions, that means if "/usr/lib/debug"
|
||||
@ -2227,6 +2300,12 @@ sub environment_setup {
|
||||
$ENV{'MYSQLD'}= mysqld_client_arguments();
|
||||
$ENV{'EXE_MYSQL'}= $exe_mysql;
|
||||
|
||||
my $exe_mysqld= find_mysqld($basedir);
|
||||
$ENV{'MYSQLD'}= $exe_mysqld;
|
||||
my $extra_opts= join (" ", @opt_extra_mysqld_opt);
|
||||
$ENV{'MYSQLD_CMD'}= "$exe_mysqld --defaults-group-suffix=.1 ".
|
||||
"--defaults-file=$path_config_file $extra_opts";
|
||||
|
||||
# ----------------------------------------------------
|
||||
# bug25714 executable may _not_ exist in
|
||||
# some versions, test using it should be skipped
|
||||
@ -2587,7 +2666,7 @@ sub check_debug_support ($) {
|
||||
#
|
||||
# Helper function to find the correct value for the opt_vs_config
|
||||
# if it was not set explicitly.
|
||||
#
|
||||
#
|
||||
# the configuration with the most recent build dir in sql/ is selected.
|
||||
#
|
||||
# note: looking for all BuildLog.htm files everywhere in the tree with the
|
||||
@ -2616,6 +2695,33 @@ sub fix_vs_config_dir () {
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Helper function to handle configuration-based subdirectories which Visual
|
||||
# Studio uses for storing binaries. If opt_vs_config is set, this returns
|
||||
# a path based on that setting; if not, it returns paths for the default
|
||||
# /release/ and /debug/ subdirectories.
|
||||
#
|
||||
# $exe can be undefined, if the directory itself will be used
|
||||
#
|
||||
sub vs_config_dirs ($$) {
|
||||
my ($path_part, $exe) = @_;
|
||||
|
||||
$exe = "" if not defined $exe;
|
||||
|
||||
# Don't look in these dirs when not on windows
|
||||
return () unless IS_WINDOWS;
|
||||
|
||||
if ($opt_vs_config)
|
||||
{
|
||||
return ("$basedir/$path_part/$opt_vs_config/$exe");
|
||||
}
|
||||
|
||||
return ("$basedir/$path_part/release/$exe",
|
||||
"$basedir/$path_part/relwithdebinfo/$exe",
|
||||
"$basedir/$path_part/debug/$exe");
|
||||
}
|
||||
|
||||
|
||||
sub check_ndbcluster_support ($) {
|
||||
my $mysqld_variables= shift;
|
||||
|
||||
@ -4271,6 +4377,11 @@ sub extract_server_log ($$) {
|
||||
else
|
||||
{
|
||||
push(@lines, $line);
|
||||
if (scalar(@lines) > 1000000) {
|
||||
$Ferr = undef;
|
||||
mtr_warning("Too much log from test, bailing out from extracting");
|
||||
return ();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -83,5 +83,18 @@ a a b filler
|
||||
SET SESSION debug = DEFAULT;
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug#11747970 34660: CRASH WHEN FEDERATED TABLE LOSES CONNECTION DURING INSERT ... SELECT
|
||||
#
|
||||
CREATE TABLE t1(f1 INT, KEY(f1));
|
||||
CREATE TABLE t2(f1 INT);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
SET SESSION debug='d,bug11747970_simulate_error';
|
||||
INSERT IGNORE INTO t2 SELECT f1 FROM t1 a WHERE NOT EXISTS (SELECT 1 FROM t2 b WHERE a.f1 = b.f1);
|
||||
Warnings:
|
||||
Error 1105 Unknown error
|
||||
SET SESSION debug = DEFAULT;
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# End of 5.1 tests
|
||||
#
|
||||
|
@ -715,8 +715,8 @@ create table t1 (c char(10)) engine=memory;
|
||||
create table t2 (c varchar(10)) engine=memory;
|
||||
show table status like 't_';
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 MEMORY 10 Fixed 0 11 0 # 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 10 Fixed 0 12 0 # 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t1 MEMORY 10 Fixed 0 11 0 # 0 0 NULL # NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 10 Fixed 0 12 0 # 0 0 NULL # NULL NULL latin1_swedish_ci NULL
|
||||
drop table t1, t2;
|
||||
CREATE TABLE t1(a VARCHAR(1), b VARCHAR(2), c VARCHAR(256),
|
||||
KEY(a), KEY(b), KEY(c)) ENGINE=MEMORY;
|
||||
|
@ -2444,4 +2444,28 @@ CARDINALITY
|
||||
DROP TABLE t1;
|
||||
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
|
||||
SET myisam_repair_threads=@@global.myisam_repair_threads;
|
||||
#
|
||||
# BUG#11757032 - 49030: OPTIMIZE TABLE BREAKS MYISAM TABLE WHEN
|
||||
# USING MYISAM_USE_MMAP ON WINDOWS
|
||||
#
|
||||
SET GLOBAL myisam_use_mmap=1;
|
||||
CREATE TABLE t1(a INT);
|
||||
INSERT INTO t1 VALUES(1),(2);
|
||||
DELETE FROM t1 WHERE a=1;
|
||||
FLUSH TABLE t1;
|
||||
LOCK TABLE t1 WRITE;
|
||||
OPTIMIZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize status OK
|
||||
INSERT INTO t1 VALUES(3);
|
||||
UNLOCK TABLES;
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
2
|
||||
3
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
DROP TABLE t1;
|
||||
SET GLOBAL myisam_use_mmap=default;
|
||||
End of 5.1 tests
|
||||
|
@ -87,3 +87,35 @@ COUNT(*)
|
||||
128
|
||||
DROP TABLE mysql_db1.t1;
|
||||
DROP DATABASE mysql_db1;
|
||||
#
|
||||
# BUG#11761180 - 53646: MYISAMPACK CORRUPTS TABLES WITH FULLTEXT INDEXES
|
||||
#
|
||||
CREATE TABLE t1(a CHAR(4), FULLTEXT(a));
|
||||
INSERT INTO t1 VALUES('aaaa'),('bbbb'),('cccc');
|
||||
FLUSH TABLE t1;
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
SELECT * FROM t1 WHERE MATCH(a) AGAINST('aaaa' IN BOOLEAN MODE);
|
||||
a
|
||||
aaaa
|
||||
SELECT * FROM t1 WHERE MATCH(a) AGAINST('aaaa');
|
||||
a
|
||||
aaaa
|
||||
DROP TABLE t1;
|
||||
# Test table with key_reflength > rec_reflength
|
||||
CREATE TABLE t1(a CHAR(30), FULLTEXT(a));
|
||||
# Populating a table, so it's index file exceeds 65K
|
||||
# Populating a table, so index file has second level fulltext tree
|
||||
FLUSH TABLE t1;
|
||||
# Compressing table
|
||||
# Fixing index (repair by sort)
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
FLUSH TABLE t1;
|
||||
# Fixing index (repair with keycache)
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
DROP TABLE t1;
|
||||
|
@ -136,6 +136,10 @@ select 1146 as "after_!errno_masked_error" ;
|
||||
after_!errno_masked_error
|
||||
1146
|
||||
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146: 'Table 'test.t1' doesn't exist', instead of 1000...
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
|
||||
is empty
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'nonsense' at line 1
|
||||
is empty
|
||||
garbage ;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
|
||||
select 1064 as "after_--enable_abort_on_error" ;
|
||||
@ -144,6 +148,9 @@ after_--enable_abort_on_error
|
||||
select 3 from t1 ;
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146: 'Table 'test.t1' doesn't exist', instead of 1064...
|
||||
is empty
|
||||
is empty
|
||||
"Yes it's empty"
|
||||
hello
|
||||
hello
|
||||
;;;;;;;;
|
||||
@ -316,7 +323,7 @@ insert into t1 values ('$dollar');
|
||||
$dollar
|
||||
`select 42`
|
||||
drop table t1;
|
||||
mysqltest: At line 1: Error running query 'failing query': 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing query' at line 1
|
||||
mysqltest: At line 1: query 'let $var2= `failing query`' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing query' at line 1
|
||||
mysqltest: At line 1: Missing required argument 'filename' to command 'source'
|
||||
mysqltest: At line 1: Could not open './non_existingFile' for reading, errno: 2
|
||||
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql":
|
||||
@ -814,7 +821,7 @@ mysqltest: At line 1: Could not find column 'column_not_exists' in the result of
|
||||
mysqltest: At line 1: Query 'SET @A = 1' didn't return a result set
|
||||
mysqltest: At line 1: Could not find column '1 AS B' in the result of 'SELECT 1 AS A'
|
||||
value= No such row
|
||||
mysqltest: At line 1: Error running query 'SHOW COLNS FROM t1': 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COLNS FROM t1' at line 1
|
||||
mysqltest: At line 1: query 'let $value= query_get_value(SHOW COLNS FROM t1, Field, 1)' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COLNS FROM t1' at line 1
|
||||
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) YES -><- NULL
|
||||
|
@ -1664,4 +1664,11 @@ a 1
|
||||
3 1
|
||||
2 1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#11765255 58201:
|
||||
# VALGRIND/CRASH WHEN ORDERING BY MULTIPLE AGGREGATE FUNCTIONS
|
||||
#
|
||||
select 1 order by max(1) + min(1);
|
||||
1
|
||||
1
|
||||
End of 5.1 tests
|
||||
|
@ -1,8 +1,30 @@
|
||||
#
|
||||
# Bug#11766879/Bug#60106: DIFF BETWEEN # OF INDEXES IN MYSQL VS INNODB,
|
||||
# PARTITONING, ON INDEX CREATE
|
||||
#
|
||||
call mtr.add_suppression("contains 2 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MySQL");
|
||||
CREATE TABLE t1 (
|
||||
id bigint NOT NULL AUTO_INCREMENT,
|
||||
time date,
|
||||
id2 bigint not null,
|
||||
PRIMARY KEY (id,time)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
||||
/*!50100 PARTITION BY RANGE(TO_DAYS(time))
|
||||
(PARTITION p10 VALUES LESS THAN (734708) ENGINE = InnoDB,
|
||||
PARTITION p20 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */;
|
||||
INSERT INTO t1 (time,id2) VALUES ('2011-07-24',1);
|
||||
INSERT INTO t1 (time,id2) VALUES ('2011-07-25',1);
|
||||
INSERT INTO t1 (time,id2) VALUES ('2011-07-25',1);
|
||||
CREATE UNIQUE INDEX uk_time_id2 on t1(time,id2);
|
||||
ERROR 23000: Duplicate entry '2011-07-25-1' for key 'uk_time_id2'
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
3
|
||||
DROP TABLE t1;
|
||||
call mtr.add_suppression("nnoDB: Error: table `test`.`t1` .* Partition.* InnoDB internal");
|
||||
#
|
||||
# Bug#55091: Server crashes on ADD PARTITION after a failed attempt
|
||||
#
|
||||
SET @old_innodb_file_format_check = @@global.innodb_file_format_check;
|
||||
SET @old_innodb_file_format = @@global.innodb_file_format;
|
||||
SET @old_innodb_file_per_table = @@global.innodb_file_per_table;
|
||||
SET @old_innodb_strict_mode = @@global.innodb_strict_mode;
|
||||
@ -70,7 +92,6 @@ DROP TABLE t1;
|
||||
SET @@global.innodb_strict_mode = @old_innodb_strict_mode;
|
||||
SET @@global.innodb_file_format = @old_innodb_file_format;
|
||||
SET @@global.innodb_file_per_table = @old_innodb_file_per_table;
|
||||
SET @@global.innodb_file_format_check = @old_innodb_file_format_check;
|
||||
SET NAMES utf8;
|
||||
CREATE TABLE `t``\""e` (a INT, PRIMARY KEY (a))
|
||||
ENGINE=InnoDB
|
||||
|
@ -30,7 +30,7 @@ ERROR HY000: You are using safe update mode and you tried to update a table with
|
||||
delete from t1 where a+0=1;
|
||||
ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
|
||||
select 1 from t1,t1 as t2,t1 as t3,t1 as t4,t1 as t5;
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
update t1 set b="a" limit 1;
|
||||
update t1 set b="a" where b="b" limit 2;
|
||||
delete from t1 where b="test" limit 1;
|
||||
@ -42,7 +42,7 @@ SELECT @@MAX_JOIN_SIZE, @@SQL_BIG_SELECTS;
|
||||
2 0
|
||||
insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a");
|
||||
SELECT * from t1 order by a;
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
SET SQL_BIG_SELECTS=1;
|
||||
SELECT * from t1 order by a;
|
||||
a b
|
||||
@ -52,7 +52,7 @@ a b
|
||||
5 a
|
||||
SET MAX_JOIN_SIZE=2;
|
||||
SELECT * from t1;
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
SET MAX_JOIN_SIZE=DEFAULT;
|
||||
SELECT * from t1;
|
||||
a b
|
||||
@ -82,12 +82,12 @@ insert into t1 select * from t1;
|
||||
insert into t1 select * from t1;
|
||||
set local max_join_size=8;
|
||||
select * from (select * from t1) x;
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
set local max_join_size=1;
|
||||
select * from (select a.a as aa, b.a as ba from t1 a, t1 b) x;
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
set local max_join_size=1;
|
||||
select * from (select 1 union select 2 union select 3) x;
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
drop table t1;
|
||||
SET SQL_SAFE_UPDATES=0,SQL_SELECT_LIMIT=DEFAULT, SQL_MAX_JOIN_SIZE=DEFAULT;
|
||||
|
@ -456,57 +456,57 @@ insert into t2 values (1),(2);
|
||||
insert into t3 values (1,1),(2,2);
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 MEMORY 10 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 10 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 10 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t1 MEMORY 10 Fixed 2 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 10 Fixed 2 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 10 Fixed 2 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
|
||||
insert into t1 values (3),(4);
|
||||
insert into t2 values (3),(4);
|
||||
insert into t3 values (3,3),(4,4);
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 MEMORY 10 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 10 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 10 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t1 MEMORY 10 Fixed 4 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 10 Fixed 4 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 10 Fixed 4 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
|
||||
insert into t1 values (5);
|
||||
insert into t2 values (5);
|
||||
insert into t3 values (5,5);
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 MEMORY 10 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 10 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 10 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t1 MEMORY 10 Fixed 5 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 10 Fixed 5 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 10 Fixed 5 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
|
||||
delete from t1 where a=3;
|
||||
delete from t2 where b=3;
|
||||
delete from t3 where a=3;
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 MEMORY 10 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 10 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 10 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t1 MEMORY 10 Fixed 4 # # # # # NULL # NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 10 Fixed 4 # # # # # NULL # NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 10 Fixed 4 # # # # # NULL # NULL NULL latin1_swedish_ci NULL
|
||||
truncate table t1;
|
||||
truncate table t2;
|
||||
truncate table t3;
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 MEMORY 10 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 10 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 10 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t1 MEMORY 10 Fixed 0 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 10 Fixed 0 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 10 Fixed 0 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
|
||||
insert into t1 values (5);
|
||||
insert into t2 values (5);
|
||||
insert into t3 values (5,5);
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 MEMORY 10 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 10 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 10 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t1 MEMORY 10 Fixed 1 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 10 Fixed 1 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 10 Fixed 1 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL
|
||||
delete from t1 where a=5;
|
||||
delete from t2 where b=5;
|
||||
delete from t3 where a=5;
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 MEMORY 10 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 10 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 10 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t1 MEMORY 10 Fixed 0 # # # # # NULL # NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 10 Fixed 0 # # # # # NULL # NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 10 Fixed 0 # # # # # NULL # NULL NULL latin1_swedish_ci NULL
|
||||
drop table t1, t2, t3;
|
||||
create database mysqltest;
|
||||
show create database mysqltest;
|
||||
@ -657,7 +657,7 @@ DROP TABLE t1;
|
||||
flush tables;
|
||||
SHOW TABLE STATUS like 't1';
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 NULL NULL NULL NULL # # # # NULL NULL NULL NULL NULL NULL NULL NULL Incorrect information in file: './test/t1.frm'
|
||||
t1 NULL NULL NULL NULL # # # # NULL NULL # NULL NULL NULL NULL NULL Incorrect information in file: './test/t1.frm'
|
||||
Warnings:
|
||||
Warning 1033 Incorrect information in file: './test/t1.frm'
|
||||
show create table t1;
|
||||
|
@ -1685,4 +1685,20 @@ ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function
|
||||
DROP PROCEDURE p1;
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#12428824 - PARSER STACK OVERFLOW AND CRASH IN SP_ADD_USED_ROUTINE
|
||||
# WITH OBSCURE QUERY
|
||||
#
|
||||
SELECT very_long_fn_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999();
|
||||
ERROR 42000: Identifier name 'very_long_fn_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222' is too long
|
||||
CALL very_long_pr_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999();
|
||||
ERROR 42000: Identifier name 'very_long_pr_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222' is too long
|
||||
SELECT very_long_db_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999.simple_func();
|
||||
ERROR 42000: Incorrect database name 'very_long_db_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222'
|
||||
CALL very_long_db_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999.simple_proc();
|
||||
ERROR 42000: Incorrect database name 'very_long_db_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222'
|
||||
SELECT db_name.very_long_fn_name_111111111111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999999999999999999();
|
||||
ERROR 42000: Identifier name 'very_long_fn_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222' is too long
|
||||
CALL db_name.very_long_pr_name_111111111111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999999999999999999();
|
||||
ERROR 42000: Identifier name 'very_long_pr_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222' is too long
|
||||
End of 5.1 tests
|
||||
|
@ -7054,6 +7054,21 @@ SET @@GLOBAL.init_connect= @old_init_connect;
|
||||
DROP PROCEDURE p2;
|
||||
DROP PROCEDURE p5;
|
||||
#
|
||||
# Bug#11840395 (formerly known as bug#60347):
|
||||
# The string "versiondata" seems
|
||||
# to be 'leaking' into the schema name space
|
||||
#
|
||||
DROP DATABASE IF EXISTS mixedCaseDbName;
|
||||
CREATE DATABASE mixedCaseDbName;
|
||||
CREATE PROCEDURE mixedCaseDbName.tryMyProc() begin end|
|
||||
CREATE FUNCTION mixedCaseDbName.tryMyFunc() returns text begin return 'IT WORKS'; end
|
||||
|
|
||||
call mixedCaseDbName.tryMyProc();
|
||||
select mixedCaseDbName.tryMyFunc();
|
||||
mixedCaseDbName.tryMyFunc()
|
||||
IT WORKS
|
||||
DROP DATABASE mixedCaseDbName;
|
||||
#
|
||||
# Bug#11766594 59736: SELECT DISTINCT.. INCORRECT RESULT WITH DETERMINISTIC FUNCTION IN WHERE C
|
||||
#
|
||||
CREATE TABLE t1 (a INT, b INT, KEY(b));
|
||||
|
@ -407,4 +407,13 @@ SELECT f1 FROM t1;
|
||||
f1
|
||||
-1.79769313486231e+308
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#12406055 BUFFER OVERFLOW OF VARIABLE 'BUFF' IN STRING::SET_REAL
|
||||
#
|
||||
# Ignoring output from misc. float operations
|
||||
select format(-1.7976931348623157E+307,256) as foo;
|
||||
select least(-1.1111111111111111111111111,
|
||||
- group_concat(1.7976931348623157E+308)) as foo;
|
||||
select concat((truncate((-1.7976931348623157E+307),(0x1e))),
|
||||
(99999999999999999999999999999999999999999999999999999999999999999)) into @a;
|
||||
End of 5.0 tests
|
||||
|
@ -1549,6 +1549,50 @@ select * from t1;
|
||||
5.05 / 0.014
|
||||
360.714286
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#12563865
|
||||
# ROUNDED,TMP_BUF,DECIMAL_VALUE STACK CORRUPTION IN ALL VERSIONS >=5.0
|
||||
#
|
||||
SELECT substring(('M') FROM (999999999999999999999999999999999999999999999999999999999999999999999999999999999)) AS foo;
|
||||
foo
|
||||
|
||||
Warnings:
|
||||
Error 1292 Truncated incorrect DECIMAL value: ''
|
||||
Error 1292 Truncated incorrect DECIMAL value: ''
|
||||
SELECT min(999999999999999999999999999999999999999999999999999999999999999999999999999999999) AS foo;
|
||||
foo
|
||||
999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
||||
SELECT multipolygonfromtext(('4294967294.1'),(999999999999999999999999999999999999999999999999999999999999999999999999999999999)) AS foo;
|
||||
foo
|
||||
NULL
|
||||
Warnings:
|
||||
Error 1292 Truncated incorrect DECIMAL value: ''
|
||||
SELECT convert((999999999999999999999999999999999999999999999999999999999999999999999999999999999), decimal(30,30)) AS foo;
|
||||
foo
|
||||
0.999999999999999999999999999999
|
||||
Warnings:
|
||||
Error 1264 Out of range value for column 'foo' at row 1
|
||||
SELECT bit_xor(999999999999999999999999999999999999999999999999999999999999999999999999999999999) AS foo;
|
||||
foo
|
||||
9223372036854775807
|
||||
Warnings:
|
||||
Error 1292 Truncated incorrect DECIMAL value: ''
|
||||
SELECT -(999999999999999999999999999999999999999999999999999999999999999999999999999999999) AS foo;
|
||||
foo
|
||||
-999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
||||
SELECT date_sub((999999999999999999999999999999999999999999999999999999999999999999999999999999999),
|
||||
interval ((SELECT date_add((0x77500000),
|
||||
interval ('Oml') second)))
|
||||
day_minute)
|
||||
AS foo;
|
||||
foo
|
||||
NULL
|
||||
Warnings:
|
||||
Error 1292 Truncated incorrect DECIMAL value: ''
|
||||
Warning 1292 Incorrect datetime value: '9223372036854775807'
|
||||
SELECT truncate(999999999999999999999999999999999999999999999999999999999999999999999999999999999, 28) AS foo;
|
||||
foo
|
||||
999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
||||
End of 5.0 tests
|
||||
select cast(143.481 as decimal(4,1));
|
||||
cast(143.481 as decimal(4,1))
|
||||
|
@ -1663,4 +1663,61 @@ a
|
||||
7
|
||||
8
|
||||
drop table t1;
|
||||
#
|
||||
# Bug#11765255 58201:
|
||||
# VALGRIND/CRASH WHEN ORDERING BY MULTIPLE AGGREGATE FUNCTIONS
|
||||
#
|
||||
select 1 as foo
|
||||
union
|
||||
select 2
|
||||
union
|
||||
select 3
|
||||
union
|
||||
select 4
|
||||
order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
|
||||
;
|
||||
foo
|
||||
1
|
||||
prepare stmt1 from 'select 1 as foo
|
||||
union
|
||||
select 2
|
||||
union
|
||||
select 3
|
||||
union
|
||||
select 4
|
||||
order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
|
||||
';
|
||||
execute stmt1;
|
||||
foo
|
||||
1
|
||||
execute stmt1;
|
||||
foo
|
||||
1
|
||||
select 1 as foo
|
||||
union
|
||||
select 2
|
||||
union
|
||||
select 3
|
||||
union
|
||||
(select 4)
|
||||
order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
|
||||
;
|
||||
foo
|
||||
1
|
||||
prepare stmt1 from 'select 1 as foo
|
||||
union
|
||||
select 2
|
||||
union
|
||||
select 3
|
||||
union
|
||||
(select 4)
|
||||
order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
|
||||
';
|
||||
execute stmt1;
|
||||
foo
|
||||
1
|
||||
execute stmt1;
|
||||
foo
|
||||
1
|
||||
deallocate prepare stmt1;
|
||||
End of 5.1 tests
|
||||
|
@ -66,10 +66,12 @@ create view mysqltest.v1 (c,d) as select a+1,b+1 from mysqltest.t1;
|
||||
create algorithm=temptable view mysqltest.v2 (c,d) as select a+1,b+1 from mysqltest.t1;
|
||||
create view mysqltest.v3 (c,d) as select a+1,b+1 from mysqltest.t2;
|
||||
create algorithm=temptable view mysqltest.v4 (c,d) as select a+1,b+1 from mysqltest.t2;
|
||||
create view mysqltest.v5 (c,d) as select a+1,b+1 from mysqltest.t1;
|
||||
grant select on mysqltest.v1 to mysqltest_1@localhost;
|
||||
grant select on mysqltest.v2 to mysqltest_1@localhost;
|
||||
grant select on mysqltest.v3 to mysqltest_1@localhost;
|
||||
grant select on mysqltest.v4 to mysqltest_1@localhost;
|
||||
grant show view on mysqltest.v5 to mysqltest_1@localhost;
|
||||
select c from mysqltest.v1;
|
||||
c
|
||||
select c from mysqltest.v2;
|
||||
@ -78,6 +80,8 @@ select c from mysqltest.v3;
|
||||
c
|
||||
select c from mysqltest.v4;
|
||||
c
|
||||
select c from mysqltest.v5;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v5'
|
||||
show columns from mysqltest.v1;
|
||||
Field Type Null Key Default Extra
|
||||
c bigint(12) YES NULL
|
||||
@ -102,16 +106,25 @@ explain select c from mysqltest.v4;
|
||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
||||
show create view mysqltest.v4;
|
||||
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v4'
|
||||
explain select c from mysqltest.v5;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v5'
|
||||
show create view mysqltest.v5;
|
||||
View Create View character_set_client collation_connection
|
||||
v5 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v5` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci
|
||||
explain select c from mysqltest.v1;
|
||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
||||
show create view mysqltest.v1;
|
||||
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1'
|
||||
grant show view on mysqltest.v1 to mysqltest_1@localhost;
|
||||
grant select on mysqltest.t1 to mysqltest_1@localhost;
|
||||
explain select c from mysqltest.v1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
|
||||
show create view mysqltest.v1;
|
||||
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1'
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci
|
||||
explain select c from mysqltest.v2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
|
||||
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
||||
show create view mysqltest.v2;
|
||||
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v2'
|
||||
explain select c from mysqltest.v3;
|
||||
@ -122,6 +135,11 @@ explain select c from mysqltest.v4;
|
||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
||||
show create view mysqltest.v4;
|
||||
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v4'
|
||||
explain select c from mysqltest.v5;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v5'
|
||||
show create view mysqltest.v5;
|
||||
View Create View character_set_client collation_connection
|
||||
v5 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v5` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci
|
||||
grant show view on mysqltest.* to mysqltest_1@localhost;
|
||||
explain select c from mysqltest.v1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -137,15 +155,12 @@ show create view mysqltest.v2;
|
||||
View Create View character_set_client collation_connection
|
||||
v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v2` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci
|
||||
explain select c from mysqltest.v3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found
|
||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
||||
show create view mysqltest.v3;
|
||||
View Create View character_set_client collation_connection
|
||||
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v3` AS select (`mysqltest`.`t2`.`a` + 1) AS `c`,(`mysqltest`.`t2`.`b` + 1) AS `d` from `mysqltest`.`t2` latin1 latin1_swedish_ci
|
||||
explain select c from mysqltest.v4;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
|
||||
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
||||
show create view mysqltest.v4;
|
||||
View Create View character_set_client collation_connection
|
||||
v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v4` AS select (`mysqltest`.`t2`.`a` + 1) AS `c`,(`mysqltest`.`t2`.`b` + 1) AS `d` from `mysqltest`.`t2` latin1 latin1_swedish_ci
|
||||
@ -947,6 +962,197 @@ DROP USER foo;
|
||||
DROP VIEW db1.v1;
|
||||
DROP TABLE db1.t1;
|
||||
DROP DATABASE db1;
|
||||
Bug #11765687/#58677:
|
||||
No privilege on table/view, but can know #rows / underlying table's name
|
||||
create database mysqltest1;
|
||||
create table mysqltest1.t1 (i int);
|
||||
create table mysqltest1.t2 (j int);
|
||||
create table mysqltest1.t3 (k int, secret int);
|
||||
create user alice@localhost;
|
||||
create user bob@localhost;
|
||||
create user cecil@localhost;
|
||||
create user dan@localhost;
|
||||
create user eugene@localhost;
|
||||
create user fiona@localhost;
|
||||
create user greg@localhost;
|
||||
create user han@localhost;
|
||||
create user inga@localhost;
|
||||
create user jamie@localhost;
|
||||
create user karl@localhost;
|
||||
create user lena@localhost;
|
||||
create user mhairi@localhost;
|
||||
create user noam@localhost;
|
||||
create user olga@localhost;
|
||||
create user pjotr@localhost;
|
||||
create user quintessa@localhost;
|
||||
grant all privileges on mysqltest1.* to alice@localhost with grant option;
|
||||
... as alice
|
||||
create view v1 as select * from t1;
|
||||
create view v2 as select * from v1, t2;
|
||||
create view v3 as select k from t3;
|
||||
grant select on mysqltest1.v1 to bob@localhost;
|
||||
grant show view on mysqltest1.v1 to cecil@localhost;
|
||||
grant select, show view on mysqltest1.v1 to dan@localhost;
|
||||
grant select on mysqltest1.t1 to dan@localhost;
|
||||
grant select on mysqltest1.* to eugene@localhost;
|
||||
grant select, show view on mysqltest1.v2 to fiona@localhost;
|
||||
grant select, show view on mysqltest1.v2 to greg@localhost;
|
||||
grant show view on mysqltest1.v1 to greg@localhost;
|
||||
grant select(k) on mysqltest1.t3 to han@localhost;
|
||||
grant select, show view on mysqltest1.v3 to han@localhost;
|
||||
grant select on mysqltest1.t1 to inga@localhost;
|
||||
grant select on mysqltest1.t2 to inga@localhost;
|
||||
grant select on mysqltest1.v1 to inga@localhost;
|
||||
grant select, show view on mysqltest1.v2 to inga@localhost;
|
||||
grant select on mysqltest1.t1 to jamie@localhost;
|
||||
grant select on mysqltest1.t2 to jamie@localhost;
|
||||
grant show view on mysqltest1.v1 to jamie@localhost;
|
||||
grant select, show view on mysqltest1.v2 to jamie@localhost;
|
||||
grant select on mysqltest1.t1 to karl@localhost;
|
||||
grant select on mysqltest1.t2 to karl@localhost;
|
||||
grant select, show view on mysqltest1.v1 to karl@localhost;
|
||||
grant select on mysqltest1.v2 to karl@localhost;
|
||||
grant select on mysqltest1.t1 to lena@localhost;
|
||||
grant select on mysqltest1.t2 to lena@localhost;
|
||||
grant select, show view on mysqltest1.v1 to lena@localhost;
|
||||
grant show view on mysqltest1.v2 to lena@localhost;
|
||||
grant select on mysqltest1.t1 to mhairi@localhost;
|
||||
grant select on mysqltest1.t2 to mhairi@localhost;
|
||||
grant select, show view on mysqltest1.v1 to mhairi@localhost;
|
||||
grant select, show view on mysqltest1.v2 to mhairi@localhost;
|
||||
grant select on mysqltest1.t1 to noam@localhost;
|
||||
grant select, show view on mysqltest1.v1 to noam@localhost;
|
||||
grant select, show view on mysqltest1.v2 to noam@localhost;
|
||||
grant select on mysqltest1.t2 to olga@localhost;
|
||||
grant select, show view on mysqltest1.v1 to olga@localhost;
|
||||
grant select, show view on mysqltest1.v2 to olga@localhost;
|
||||
grant select on mysqltest1.t1 to pjotr@localhost;
|
||||
grant select on mysqltest1.t2 to pjotr@localhost;
|
||||
grant select, show view on mysqltest1.v2 to pjotr@localhost;
|
||||
grant select, show view on mysqltest1.v1 to quintessa@localhost;
|
||||
... as bob
|
||||
select * from v1;
|
||||
i
|
||||
explain select * from v1;
|
||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
||||
... as cecil
|
||||
select * from v1;
|
||||
ERROR 42000: SELECT command denied to user 'cecil'@'localhost' for table 'v1'
|
||||
explain select * from v1;
|
||||
ERROR 42000: SELECT command denied to user 'cecil'@'localhost' for table 'v1'
|
||||
... as dan
|
||||
select * from v1;
|
||||
i
|
||||
explain select * from v1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
|
||||
... as eugene
|
||||
select * from v1;
|
||||
i
|
||||
explain select * from v1;
|
||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
||||
... as fiona
|
||||
select * from v2;
|
||||
i j
|
||||
show create view v2;
|
||||
View Create View character_set_client collation_connection
|
||||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`alice`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `v1`.`i` AS `i`,`t2`.`j` AS `j` from (`v1` join `t2`) latin1 latin1_swedish_ci
|
||||
explain select * from t1;
|
||||
ERROR 42000: SELECT command denied to user 'fiona'@'localhost' for table 't1'
|
||||
explain select * from v1;
|
||||
ERROR 42000: SELECT command denied to user 'fiona'@'localhost' for table 'v1'
|
||||
explain select * from t2;
|
||||
ERROR 42000: SELECT command denied to user 'fiona'@'localhost' for table 't2'
|
||||
explain select * from v2;
|
||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
||||
... as greg
|
||||
select * from v2;
|
||||
i j
|
||||
explain select * from v1;
|
||||
ERROR 42000: SELECT command denied to user 'greg'@'localhost' for table 'v1'
|
||||
explain select * from v2;
|
||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
||||
... as han
|
||||
select * from t3;
|
||||
ERROR 42000: SELECT command denied to user 'han'@'localhost' for table 't3'
|
||||
explain select * from t3;
|
||||
ERROR 42000: SELECT command denied to user 'han'@'localhost' for table 't3'
|
||||
select k from t3;
|
||||
k
|
||||
explain select k from t3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found
|
||||
select * from v3;
|
||||
k
|
||||
explain select * from v3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found
|
||||
... as inga
|
||||
select * from v2;
|
||||
i j
|
||||
explain select * from v2;
|
||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
||||
... as jamie
|
||||
select * from v2;
|
||||
i j
|
||||
explain select * from v2;
|
||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
||||
... as karl
|
||||
select * from v2;
|
||||
i j
|
||||
explain select * from v2;
|
||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
||||
... as lena
|
||||
select * from v2;
|
||||
ERROR 42000: SELECT command denied to user 'lena'@'localhost' for table 'v2'
|
||||
explain select * from v2;
|
||||
ERROR 42000: SELECT command denied to user 'lena'@'localhost' for table 'v2'
|
||||
... as mhairi
|
||||
select * from v2;
|
||||
i j
|
||||
explain select * from v2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
|
||||
1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found
|
||||
... as noam
|
||||
select * from v2;
|
||||
i j
|
||||
explain select * from v2;
|
||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
||||
... as olga
|
||||
select * from v2;
|
||||
i j
|
||||
explain select * from v2;
|
||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
||||
... as pjotr
|
||||
select * from v2;
|
||||
i j
|
||||
explain select * from v2;
|
||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
||||
... as quintessa
|
||||
select * from v1;
|
||||
i
|
||||
explain select * from v1;
|
||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
||||
... as root again at last: clean-up time!
|
||||
drop user alice@localhost;
|
||||
drop user bob@localhost;
|
||||
drop user cecil@localhost;
|
||||
drop user dan@localhost;
|
||||
drop user eugene@localhost;
|
||||
drop user fiona@localhost;
|
||||
drop user greg@localhost;
|
||||
drop user han@localhost;
|
||||
drop user inga@localhost;
|
||||
drop user jamie@localhost;
|
||||
drop user karl@localhost;
|
||||
drop user lena@localhost;
|
||||
drop user mhairi@localhost;
|
||||
drop user noam@localhost;
|
||||
drop user olga@localhost;
|
||||
drop user pjotr@localhost;
|
||||
drop user quintessa@localhost;
|
||||
drop database mysqltest1;
|
||||
End of 5.0 tests.
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
@ -1,4 +1,5 @@
|
||||
DROP TABLE IF EXISTS t1,t2,t3;
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NOT NULL PRIMARY KEY);
|
||||
SET TIMESTAMP=1171346973;
|
||||
INSERT INTO t1 (c1) VALUES(NOW());
|
||||
@ -89,3 +90,4 @@ c1
|
||||
2007-02-16 12:10:34
|
||||
2007-02-17 13:10:34
|
||||
DROP TABLE t1;
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,4 +1,5 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NULL, c3 DATE NULL, PRIMARY KEY(c1), UNIQUE(c2));
|
||||
SET TIMESTAMP=1171346973;
|
||||
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),ADDTIME(NOW(),'4 04:01:01'),NOW());
|
||||
@ -128,3 +129,4 @@ c1 c2 c3
|
||||
2003 2001 2000
|
||||
2004 2000 2000
|
||||
DROP TABLE t1;
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,4 +1,5 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NOT NULL PRIMARY KEY);
|
||||
SET TIMESTAMP=1171346973;
|
||||
INSERT INTO t1 (c1) VALUES(NOW());
|
||||
@ -82,3 +83,4 @@ c1
|
||||
2000
|
||||
2011
|
||||
DROP TABLE t1;
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,4 +1,5 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NOT NULL PRIMARY KEY);
|
||||
SET TIMESTAMP=1171346973;
|
||||
INSERT INTO t1 (c1) VALUES(NOW());
|
||||
@ -87,3 +88,4 @@ c1
|
||||
1999
|
||||
2000
|
||||
DROP TABLE t1;
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,4 +1,5 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NOT NULL PRIMARY KEY);
|
||||
SET TIMESTAMP=1171346973;
|
||||
INSERT INTO t1 (c1) VALUES(NOW());
|
||||
@ -87,3 +88,4 @@ c1
|
||||
1999
|
||||
2000
|
||||
DROP TABLE t1;
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,4 +1,5 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NULL UNIQUE);
|
||||
SET TIMESTAMP=1171346973;
|
||||
INSERT INTO t1 (c1) VALUES(NOW());
|
||||
@ -82,3 +83,4 @@ c1
|
||||
2000
|
||||
2011
|
||||
DROP TABLE t1;
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,4 +1,5 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NULL UNIQUE);
|
||||
SET TIMESTAMP=1171346973;
|
||||
INSERT INTO t1 (c1) VALUES(NOW());
|
||||
@ -87,3 +88,4 @@ c1
|
||||
1999
|
||||
2000
|
||||
DROP TABLE t1;
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,4 +1,5 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NULL UNIQUE);
|
||||
SET TIMESTAMP=1171346973;
|
||||
INSERT INTO t1 (c1) VALUES(NOW());
|
||||
@ -81,3 +82,4 @@ c1
|
||||
1999
|
||||
2000
|
||||
DROP TABLE t1;
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,4 +1,5 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NOT NULL, c3 DATE NOT NULL, PRIMARY KEY(c1,c2,c3));
|
||||
SET TIMESTAMP=1171346973;
|
||||
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
|
||||
@ -144,3 +145,4 @@ c1 c2 c3
|
||||
2011 2011 2000
|
||||
2011 2011 2011
|
||||
DROP TABLE t1;
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,4 +1,5 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NOT NULL, c3 DATE NOT NULL, PRIMARY KEY(c1,c2,c3));
|
||||
SET TIMESTAMP=1171346973;
|
||||
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
|
||||
@ -147,3 +148,4 @@ c1 c2 c3
|
||||
1999 2000 1999
|
||||
2000 1999 1999
|
||||
DROP TABLE t1;
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,4 +1,5 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NOT NULL, c3 DATE NOT NULL, PRIMARY KEY(c1,c2,c3));
|
||||
SET TIMESTAMP=1171346973;
|
||||
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
|
||||
@ -147,3 +148,4 @@ c1 c2 c3
|
||||
1999 2000 1999
|
||||
2000 1999 1999
|
||||
DROP TABLE t1;
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,4 +1,5 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NULL, c2 DATE NULL, c3 DATE NULL, UNIQUE(c1,c2,c3));
|
||||
SET TIMESTAMP=1171346973;
|
||||
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
|
||||
@ -144,3 +145,4 @@ c1 c2 c3
|
||||
2011 2011 2000
|
||||
2011 2011 2011
|
||||
DROP TABLE t1;
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,4 +1,5 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NULL, c2 DATE NULL, c3 DATE NULL, UNIQUE(c1,c2,c3));
|
||||
SET TIMESTAMP=1171346973;
|
||||
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
|
||||
@ -147,3 +148,4 @@ c1 c2 c3
|
||||
1999 2000 1999
|
||||
2000 1999 1999
|
||||
DROP TABLE t1;
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,4 +1,5 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NULL, c2 DATE NULL, c3 DATE NULL, UNIQUE(c1,c2,c3));
|
||||
SET TIMESTAMP=1171346973;
|
||||
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
|
||||
@ -139,3 +140,4 @@ c1 c2 c3
|
||||
1999 2000 1999
|
||||
2000 1999 1999
|
||||
DROP TABLE t1;
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,4 +1,5 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NOT NULL, c3 DATE NOT NULL, PRIMARY KEY(c1,c2,c3));
|
||||
SET TIMESTAMP=1171346973;
|
||||
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
|
||||
@ -144,3 +145,4 @@ c1 c2 c3
|
||||
2011 2011 2000
|
||||
2011 2011 2011
|
||||
DROP TABLE t1;
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,4 +1,5 @@
|
||||
DROP TABLE IF EXISTS t1,t2,t3;
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NOT NULL);
|
||||
SET TIMESTAMP=1171346973;
|
||||
INSERT INTO t1 (c1) VALUES(NOW());
|
||||
@ -104,3 +105,4 @@ c1
|
||||
2007-02-13 09:09:33
|
||||
2007-02-14 10:10:34
|
||||
DROP TABLE t1;
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,6 +1,8 @@
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1,t2,t3;
|
||||
--enable_warnings
|
||||
# Set Correct timezone to match result
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NOT NULL PRIMARY KEY);
|
||||
SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
|
||||
INSERT INTO t1 (c1) VALUES(NOW());
|
||||
@ -45,4 +47,5 @@ SELECT * FROM t1 ORDER BY c1;
|
||||
DELETE FROM t1 WHERE c1 <= ADDTIME(NOW(),'2 02:01:01');
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Restore timezone to default
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,6 +1,8 @@
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
# Set Correct timezone to match result
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NULL, c3 DATE NULL, PRIMARY KEY(c1), UNIQUE(c2));
|
||||
SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
|
||||
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),ADDTIME(NOW(),'4 04:01:01'),NOW());
|
||||
@ -70,4 +72,6 @@ INSERT INTO t1 (c1,c2,c3) VALUES(2000,2000,2000) ON DUPLICATE KEY UPDATE c3=2011
|
||||
--sorted_result
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
# Restore timezone to default
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
# Set Correct timezone to match result
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NOT NULL PRIMARY KEY);
|
||||
SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
|
||||
INSERT INTO t1 (c1) VALUES(NOW());
|
||||
@ -61,4 +63,5 @@ INSERT INTO t1 (c1) VALUES(1999) ON DUPLICATE KEY UPDATE c1=2011;
|
||||
--sorted_result
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Restore timezone to default
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,6 +1,8 @@
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
# Set Correct timezone to match result
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NOT NULL PRIMARY KEY);
|
||||
SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
|
||||
INSERT INTO t1 (c1) VALUES(NOW());
|
||||
@ -61,4 +63,5 @@ INSERT INTO t1 (c1) VALUES(2000);
|
||||
INSERT INTO t1 (c1) VALUES(1999);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Restore timezone to default
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,6 +1,8 @@
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
# Set Correct timezone to match result
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NOT NULL PRIMARY KEY);
|
||||
SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
|
||||
INSERT INTO t1 (c1) VALUES(NOW());
|
||||
@ -61,4 +63,6 @@ INSERT INTO t1 (c1) VALUES(2000);
|
||||
INSERT INTO t1 (c1) VALUES(1999);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
# Restore timezone to default
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
# Set Correct timezone to match result
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NULL UNIQUE);
|
||||
SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
|
||||
INSERT INTO t1 (c1) VALUES(NOW());
|
||||
@ -61,4 +63,5 @@ INSERT INTO t1 (c1) VALUES(1999) ON DUPLICATE KEY UPDATE c1=2011;
|
||||
--sorted_result
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Restore timezone to default
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,6 +1,8 @@
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
# Set Correct timezone to match result
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NULL UNIQUE);
|
||||
SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
|
||||
INSERT INTO t1 (c1) VALUES(NOW());
|
||||
@ -61,4 +63,5 @@ INSERT INTO t1 (c1) VALUES(2000);
|
||||
INSERT INTO t1 (c1) VALUES(1999);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Restore timezone to default
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,6 +1,8 @@
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
# Set Correct timezone to match result
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NULL UNIQUE);
|
||||
SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
|
||||
INSERT INTO t1 (c1) VALUES(NOW());
|
||||
@ -53,4 +55,5 @@ INSERT INTO t1 (c1) VALUES(2000);
|
||||
INSERT IGNORE INTO t1 (c1) VALUES(1999);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#restore timezone to default
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,6 +1,8 @@
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
# Set Correct timezone to match result
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NOT NULL, c3 DATE NOT NULL, PRIMARY KEY(c1,c2,c3));
|
||||
SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
|
||||
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
|
||||
@ -85,4 +87,6 @@ INSERT INTO t1 (c1,c2,c3) VALUES(1999,1999,2000) ON DUPLICATE KEY UPDATE c1=2011
|
||||
--sorted_result
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
# Restore timezone to default
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
# Set Correct timezone to match result
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NOT NULL, c3 DATE NOT NULL, PRIMARY KEY(c1,c2,c3));
|
||||
SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
|
||||
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
|
||||
@ -93,4 +95,5 @@ INSERT INTO t1 (c1,c2,c3) VALUES(1999,1999,1999);
|
||||
INSERT INTO t1 (c1,c2,c3) VALUES(1999,1999,2000);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Restore timezone to default
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,6 +1,8 @@
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
# Set Correct timezone to match result
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NOT NULL, c3 DATE NOT NULL, PRIMARY KEY(c1,c2,c3));
|
||||
SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
|
||||
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
|
||||
@ -93,4 +95,5 @@ INSERT INTO t1 (c1,c2,c3) VALUES(1999,1999,1999);
|
||||
INSERT INTO t1 (c1,c2,c3) VALUES(1999,1999,2000);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Restore timezone to default
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,6 +1,8 @@
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
# Set Correct timezone to match result
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NULL, c2 DATE NULL, c3 DATE NULL, UNIQUE(c1,c2,c3));
|
||||
SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
|
||||
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
|
||||
@ -85,4 +87,5 @@ INSERT INTO t1 (c1,c2,c3) VALUES(1999,1999,2000) ON DUPLICATE KEY UPDATE c1=2011
|
||||
--sorted_result
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Restore timezone to default
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,6 +1,8 @@
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
# Set Correct timezone to match result
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NULL, c2 DATE NULL, c3 DATE NULL, UNIQUE(c1,c2,c3));
|
||||
SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
|
||||
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
|
||||
@ -93,4 +95,5 @@ INSERT INTO t1 (c1,c2,c3) VALUES(1999,1999,1999);
|
||||
INSERT INTO t1 (c1,c2,c3) VALUES(1999,1999,2000);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Restore timezone to default
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
@ -1,6 +1,8 @@
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
# Set Correct timezone to match result
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NULL, c2 DATE NULL, c3 DATE NULL, UNIQUE(c1,c2,c3));
|
||||
SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
|
||||
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
|
||||
@ -85,4 +87,6 @@ INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(1999,1999,2000);
|
||||
--sorted_result
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
# Restore timezone to default
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
# Set Correct timezone to match result
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NOT NULL, c3 DATE NOT NULL, PRIMARY KEY(c1,c2,c3));
|
||||
SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
|
||||
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
|
||||
@ -93,4 +95,6 @@ INSERT INTO t1 (c1,c2,c3) VALUES(1999,1999,2000) ON DUPLICATE KEY UPDATE c1=2011
|
||||
--sorted_result
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
# Restore timezone to default
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1,t2,t3;
|
||||
--enable_warnings
|
||||
# Set Correct timezone to match result
|
||||
SET TIME_ZONE="+03:00";
|
||||
CREATE TABLE t1(c1 DATE NOT NULL);
|
||||
SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
|
||||
INSERT INTO t1 (c1) VALUES(NOW());
|
||||
@ -53,4 +55,5 @@ UPDATE t1 SET c1 = NOW() WHERE c1 >= ADDTIME(NOW(),'2 02:01:01');
|
||||
--sorted_result
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Restore timezone to default
|
||||
SET TIME_ZONE= @@global.time_zone;
|
||||
|
2
mysql-test/suite/federated/federated_plugin-master.opt
Normal file
2
mysql-test/suite/federated/federated_plugin-master.opt
Normal file
@ -0,0 +1,2 @@
|
||||
--plugin_dir=$FEDERATED_PLUGIN_DIR
|
||||
--loose-federated=ON
|
19
mysql-test/suite/federated/federated_plugin.result
Normal file
19
mysql-test/suite/federated/federated_plugin.result
Normal file
@ -0,0 +1,19 @@
|
||||
CREATE TABLE t2(a int);
|
||||
CREATE TABLE t1(a int) ENGINE=FEDERATED
|
||||
CONNECTION='mysql://root@localhost:$MASTER_MYPORT/test/t2';
|
||||
Warnings:
|
||||
Warning 1286 Unknown table engine 'FEDERATED'
|
||||
Warning 1266 Using storage engine MyISAM for table 't1'
|
||||
DROP TABLE t1;
|
||||
INSTALL PLUGIN federated SONAME 'FEDERATED_PLUGIN';
|
||||
INSTALL PLUGIN FEDERATED SONAME 'FEDERATED_PLUGIN';
|
||||
ERROR HY000: Function 'FEDERATED' already exists
|
||||
UNINSTALL PLUGIN federated;
|
||||
INSTALL PLUGIN federated SONAME 'FEDERATED_PLUGIN';
|
||||
CREATE TABLE t1(a int) ENGINE=FEDERATED
|
||||
CONNECTION='mysql://root@localhost:$MASTER_MYPORT/test/t2';
|
||||
DROP TABLE t1;
|
||||
UNINSTALL PLUGIN federated;
|
||||
UNINSTALL PLUGIN federated;
|
||||
ERROR 42000: PLUGIN federated does not exist
|
||||
DROP TABLE t2;
|
37
mysql-test/suite/federated/federated_plugin.test
Normal file
37
mysql-test/suite/federated/federated_plugin.test
Normal file
@ -0,0 +1,37 @@
|
||||
--source include/have_federated_plugin.inc
|
||||
|
||||
# Uninstall will not uninstall if ps has been used
|
||||
--disable_ps_protocol
|
||||
|
||||
connect (master,localhost,root,,test,$MASTER_MYPORT,);
|
||||
connect (slave,localhost,root,,test,$SLAVE_MYPORT,);
|
||||
|
||||
connection master;
|
||||
CREATE TABLE t2(a int);
|
||||
|
||||
connection slave;
|
||||
CREATE TABLE t1(a int) ENGINE=FEDERATED
|
||||
CONNECTION='mysql://root@localhost:$MASTER_MYPORT/test/t2';
|
||||
DROP TABLE t1;
|
||||
|
||||
--replace_result $FEDERATED_PLUGIN FEDERATED_PLUGIN
|
||||
eval INSTALL PLUGIN federated SONAME '$FEDERATED_PLUGIN';
|
||||
--replace_result $FEDERATED_PLUGIN FEDERATED_PLUGIN
|
||||
--error ER_UDF_EXISTS
|
||||
eval INSTALL PLUGIN FEDERATED SONAME '$FEDERATED_PLUGIN';
|
||||
|
||||
UNINSTALL PLUGIN federated;
|
||||
|
||||
--replace_result $FEDERATED_PLUGIN FEDERATED_PLUGIN
|
||||
eval INSTALL PLUGIN federated SONAME '$FEDERATED_PLUGIN';
|
||||
|
||||
CREATE TABLE t1(a int) ENGINE=FEDERATED
|
||||
CONNECTION='mysql://root@localhost:$MASTER_MYPORT/test/t2';
|
||||
DROP TABLE t1;
|
||||
|
||||
UNINSTALL PLUGIN federated;
|
||||
--error ER_SP_DOES_NOT_EXIST
|
||||
UNINSTALL PLUGIN federated;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t2;
|
@ -55,3 +55,20 @@ id x
|
||||
1 1
|
||||
2 10
|
||||
drop table t1;
|
||||
#
|
||||
#Bug#12842206 INNODB LOCKING REGRESSION FOR INSERT IGNORE
|
||||
#fixed by re-fixing Bug#7975
|
||||
#aka Bug#11759688 52020: InnoDB can still deadlock on just INSERT...
|
||||
#
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(3,1);
|
||||
BEGIN;
|
||||
INSERT IGNORE INTO t1 VALUES(3,14);
|
||||
BEGIN;
|
||||
INSERT IGNORE INTO t1 VALUES(3,23);
|
||||
SELECT * FROM t1 FOR UPDATE;
|
||||
COMMIT;
|
||||
a b
|
||||
3 1
|
||||
COMMIT;
|
||||
DROP TABLE t1;
|
||||
|
@ -1295,6 +1295,20 @@ ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fail
|
||||
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
|
||||
ERROR 42S22: Unknown column 't1.id' in 'where clause'
|
||||
drop table t3,t2,t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 VARCHAR(8), c2 VARCHAR(8),
|
||||
PRIMARY KEY (c1, c2)
|
||||
) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (
|
||||
c0 INT PRIMARY KEY,
|
||||
c1 VARCHAR(8) UNIQUE,
|
||||
FOREIGN KEY (c1) REFERENCES t1 (c1) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES ('old', 'somevalu'), ('other', 'anyvalue');
|
||||
INSERT INTO t2 VALUES (10, 'old'), (20, 'other');
|
||||
UPDATE t1 SET c1 = 'other' WHERE c1 = 'old';
|
||||
ERROR 23000: Upholding foreign key constraints for table 't1', entry 'other-somevalu', key 2 would lead to a duplicate entry
|
||||
DROP TABLE t2,t1;
|
||||
create table t1(
|
||||
id int primary key,
|
||||
pid int,
|
||||
@ -1673,7 +1687,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
|
||||
1063
|
||||
1067
|
||||
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
|
||||
865
|
||||
|
2
mysql-test/suite/innodb/r/innodb_bug12661768.result
Normal file
2
mysql-test/suite/innodb/r/innodb_bug12661768.result
Normal file
@ -0,0 +1,2 @@
|
||||
SET SESSION foreign_key_checks=0;
|
||||
ERROR 23000: Upholding foreign key constraints for table 'bug12661768_1', entry '3-bbb', key 2 would lead to a duplicate entry
|
77
mysql-test/suite/innodb/r/innodb_replace.result
Normal file
77
mysql-test/suite/innodb/r/innodb_replace.result
Normal file
@ -0,0 +1,77 @@
|
||||
#
|
||||
#Bug#11759688 52020: InnoDB can still deadlock
|
||||
#on just INSERT...ON DUPLICATE KEY
|
||||
#a.k.a. Bug#7975 deadlock without any locking, simple select and update
|
||||
#
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(3,1);
|
||||
BEGIN;
|
||||
SET DEBUG_SYNC='write_row_noreplace SIGNAL insert1 WAIT_FOR select1';
|
||||
INSERT INTO t1 VALUES(3,2);
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert1';
|
||||
SELECT * FROM t1 LOCK IN SHARE MODE;
|
||||
a b
|
||||
3 1
|
||||
SELECT * FROM t1 FOR UPDATE;
|
||||
SET DEBUG_SYNC='now SIGNAL select1';
|
||||
ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
|
||||
INSERT INTO t1 VALUES(3,3) ON DUPLICATE KEY UPDATE b=b+10;
|
||||
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
|
||||
COMMIT;
|
||||
SET DEBUG_SYNC='write_row_replace SIGNAL insert2 WAIT_FOR select2';
|
||||
REPLACE INTO t1 VALUES(3,4);
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert2';
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
3 11
|
||||
SELECT * FROM t1 LOCK IN SHARE MODE;
|
||||
SET DEBUG_SYNC='now SIGNAL select2';
|
||||
SET DEBUG_SYNC='write_row_replace SIGNAL insert3 WAIT_FOR select3';
|
||||
INSERT INTO t1 VALUES(3,5) ON DUPLICATE KEY UPDATE b=b+20;
|
||||
a b
|
||||
3 4
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert3';
|
||||
SELECT b FROM t1 LOCK IN SHARE MODE;
|
||||
SET DEBUG_SYNC='now SIGNAL select3';
|
||||
b
|
||||
24
|
||||
SET DEBUG_SYNC='write_row_noreplace SIGNAL insert4 WAIT_FOR select4';
|
||||
LOAD DATA INFILE '../../std_data/loaddata5.dat' INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (a, b);
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert4';
|
||||
SELECT b FROM t1 WHERE a=3 LOCK IN SHARE MODE;
|
||||
b
|
||||
24
|
||||
SELECT b FROM t1 WHERE a=3 FOR UPDATE;
|
||||
SET DEBUG_SYNC='now SIGNAL select4';
|
||||
b
|
||||
24
|
||||
ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
|
||||
SET DEBUG_SYNC='write_row_noreplace SIGNAL insert5 WAIT_FOR select5';
|
||||
LOAD DATA INFILE '../../std_data/loaddata5.dat' IGNORE INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (a, b);
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert5';
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
3 24
|
||||
SELECT * FROM t1 WHERE a=3 LOCK IN SHARE MODE;
|
||||
a b
|
||||
3 24
|
||||
SELECT * FROM t1 WHERE a=3 FOR UPDATE;
|
||||
SET DEBUG_SYNC='now SIGNAL select5';
|
||||
a b
|
||||
3 24
|
||||
SET DEBUG_SYNC='write_row_replace SIGNAL insert6 WAIT_FOR select6';
|
||||
LOAD DATA INFILE '../../std_data/loaddata5.dat' REPLACE INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (a, b);
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert6';
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 2
|
||||
3 24
|
||||
5 6
|
||||
SELECT a,b FROM t1 LOCK IN SHARE MODE;
|
||||
SET DEBUG_SYNC='now SIGNAL select6';
|
||||
a b
|
||||
1 2
|
||||
3 4
|
||||
5 6
|
||||
SET DEBUG_SYNC='RESET';
|
||||
DROP TABLE t1;
|
@ -10,5 +10,6 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
#innodb : Bug#53306 2010-04-30 VasilDimov valgrind warnings
|
||||
innodb_bug53756 : Waiting for merge with Percona Server; bug fixed in innodb_plugin in MySQL 5.1.50
|
||||
#innodb_bug53756 : Waiting for merge with Percona Server; bug fixed in innodb_plugin in MySQL 5.1.50
|
||||
innodb-lock: Disabled until merging with XtraDB 5.1.60
|
||||
innodb_replace: Disabled until merging with XtraDB 5.1.60
|
||||
|
@ -100,3 +100,44 @@ select * from t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
--echo #
|
||||
--echo #Bug#12842206 INNODB LOCKING REGRESSION FOR INSERT IGNORE
|
||||
--echo #fixed by re-fixing Bug#7975
|
||||
--echo #aka Bug#11759688 52020: InnoDB can still deadlock on just INSERT...
|
||||
--echo #
|
||||
|
||||
connection default;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 VALUES(3,1);
|
||||
|
||||
BEGIN;
|
||||
# this used to wrongly acquire an X lock; now it takes an S lock
|
||||
INSERT IGNORE INTO t1 VALUES(3,14);
|
||||
|
||||
connection con1;
|
||||
BEGIN;
|
||||
# this used to wrongly acquire an X lock; now it takes an S lock
|
||||
INSERT IGNORE INTO t1 VALUES(3,23);
|
||||
--send
|
||||
SELECT * FROM t1 FOR UPDATE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'Sending data' and
|
||||
info = 'SELECT * FROM t1 FOR UPDATE';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
connection default;
|
||||
COMMIT;
|
||||
connection con1;
|
||||
reap;
|
||||
COMMIT;
|
||||
disconnect con1;
|
||||
disconnect con2;
|
||||
|
||||
connection default;
|
||||
DROP TABLE t1;
|
||||
|
@ -1023,6 +1023,24 @@ update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id
|
||||
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
|
||||
drop table t3,t2,t1;
|
||||
|
||||
# test ON UPDATE CASCADE
|
||||
CREATE TABLE t1 (
|
||||
c1 VARCHAR(8), c2 VARCHAR(8),
|
||||
PRIMARY KEY (c1, c2)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE t2 (
|
||||
c0 INT PRIMARY KEY,
|
||||
c1 VARCHAR(8) UNIQUE,
|
||||
FOREIGN KEY (c1) REFERENCES t1 (c1) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 VALUES ('old', 'somevalu'), ('other', 'anyvalue');
|
||||
INSERT INTO t2 VALUES (10, 'old'), (20, 'other');
|
||||
-- error ER_FOREIGN_DUPLICATE_KEY
|
||||
UPDATE t1 SET c1 = 'other' WHERE c1 = 'old';
|
||||
DROP TABLE t2,t1;
|
||||
|
||||
#
|
||||
# test for recursion depth limit
|
||||
#
|
||||
|
50
mysql-test/suite/innodb/t/innodb_bug12661768.test
Normal file
50
mysql-test/suite/innodb/t/innodb_bug12661768.test
Normal file
@ -0,0 +1,50 @@
|
||||
#
|
||||
# Bug#12661768 UPDATE IGNORE CRASHES SERVER IF TABLE IS INNODB AND IT IS
|
||||
# PARENT FOR OTHER ONE
|
||||
#
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
SET SESSION foreign_key_checks=0;
|
||||
|
||||
# only interested that the "UPDATE IGNORE" at the end does not crash the server
|
||||
|
||||
-- disable_query_log
|
||||
-- disable_result_log
|
||||
|
||||
SET NAMES utf8;
|
||||
|
||||
-- let $t1_name = bug12661768_1
|
||||
-- let $t2_name = bug12661768_2
|
||||
-- let $fk_name = ab_on_2
|
||||
-- let $key_str = 'bbb'
|
||||
|
||||
eval DROP TABLE IF EXISTS `$t2_name`, `$t1_name`;
|
||||
|
||||
eval CREATE TABLE `$t1_name` (
|
||||
a INT,
|
||||
b VARCHAR(512),
|
||||
PRIMARY KEY (a, b)
|
||||
) ENGINE=INNODB;
|
||||
|
||||
eval CREATE TABLE `$t2_name` (
|
||||
id INT,
|
||||
a INT,
|
||||
b VARCHAR(512),
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY `$fk_name` (a, b),
|
||||
FOREIGN KEY (a, b) REFERENCES `$t1_name` (a, b)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=INNODB;
|
||||
|
||||
eval INSERT INTO `$t1_name` VALUES (1, $key_str);
|
||||
eval INSERT INTO `$t2_name` VALUES (100, 1, $key_str), (101, 3, $key_str);
|
||||
|
||||
SET SESSION foreign_key_checks=1;
|
||||
|
||||
-- enable_result_log
|
||||
|
||||
-- error ER_FOREIGN_DUPLICATE_KEY
|
||||
eval UPDATE IGNORE `$t1_name` SET a = 3;
|
||||
|
||||
eval DROP TABLE `$t2_name`, `$t1_name`;
|
186
mysql-test/suite/innodb/t/innodb_replace.test
Normal file
186
mysql-test/suite/innodb/t/innodb_replace.test
Normal file
@ -0,0 +1,186 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug_sync.inc
|
||||
|
||||
--echo #
|
||||
--echo #Bug#11759688 52020: InnoDB can still deadlock
|
||||
--echo #on just INSERT...ON DUPLICATE KEY
|
||||
--echo #a.k.a. Bug#7975 deadlock without any locking, simple select and update
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 VALUES(3,1);
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
connect (con2,localhost,root,,);
|
||||
connection con1;
|
||||
|
||||
BEGIN;
|
||||
# normal INSERT of a duplicate should only S-lock the existing record (3,1)
|
||||
SET DEBUG_SYNC='write_row_noreplace SIGNAL insert1 WAIT_FOR select1';
|
||||
--send
|
||||
INSERT INTO t1 VALUES(3,2);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert1';
|
||||
# this should S-lock (3,1); no conflict
|
||||
SELECT * FROM t1 LOCK IN SHARE MODE;
|
||||
# this should X-lock (3,1), conflicting with con1
|
||||
--send
|
||||
SELECT * FROM t1 FOR UPDATE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'Sending data' and
|
||||
info = 'SELECT * FROM t1 FOR UPDATE';
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC='now SIGNAL select1';
|
||||
|
||||
connection con1;
|
||||
--error ER_DUP_ENTRY
|
||||
reap;
|
||||
# We are still holding an S-lock on (3,1) after the failed INSERT.
|
||||
# The following will upgrade it to an X-lock, causing a deadlock.
|
||||
# InnoDB should resolve the deadlock by aborting the blocked SELECT.
|
||||
INSERT INTO t1 VALUES(3,3) ON DUPLICATE KEY UPDATE b=b+10;
|
||||
|
||||
connection default;
|
||||
--error ER_LOCK_DEADLOCK
|
||||
reap;
|
||||
connection con1;
|
||||
COMMIT;
|
||||
|
||||
SET DEBUG_SYNC='write_row_replace SIGNAL insert2 WAIT_FOR select2';
|
||||
--send
|
||||
REPLACE INTO t1 VALUES(3,4);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert2';
|
||||
SELECT * FROM t1;
|
||||
--send
|
||||
SELECT * FROM t1 LOCK IN SHARE MODE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked because of X lock.
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'Sending data' and
|
||||
info = 'SELECT * FROM t1 LOCK IN SHARE MODE';
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC='now SIGNAL select2';
|
||||
|
||||
connection con1;
|
||||
reap;
|
||||
|
||||
SET DEBUG_SYNC='write_row_replace SIGNAL insert3 WAIT_FOR select3';
|
||||
--send
|
||||
INSERT INTO t1 VALUES(3,5) ON DUPLICATE KEY UPDATE b=b+20;
|
||||
|
||||
connection default;
|
||||
reap;
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert3';
|
||||
--send
|
||||
SELECT b FROM t1 LOCK IN SHARE MODE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked because of X lock.
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'Sending data' and
|
||||
info = 'SELECT b FROM t1 LOCK IN SHARE MODE';
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC='now SIGNAL select3';
|
||||
|
||||
connection default;
|
||||
reap;
|
||||
|
||||
connection con1;
|
||||
reap;
|
||||
SET DEBUG_SYNC='write_row_noreplace SIGNAL insert4 WAIT_FOR select4';
|
||||
--send
|
||||
LOAD DATA INFILE '../../std_data/loaddata5.dat' INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (a, b);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert4';
|
||||
# this should S-lock (3,1); no conflict
|
||||
SELECT b FROM t1 WHERE a=3 LOCK IN SHARE MODE;
|
||||
# this should X-lock (3,1), conflicting with con1
|
||||
--send
|
||||
SELECT b FROM t1 WHERE a=3 FOR UPDATE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'statistics' and
|
||||
info = 'SELECT b FROM t1 WHERE a=3 FOR UPDATE';
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC='now SIGNAL select4';
|
||||
|
||||
connection default;
|
||||
reap;
|
||||
|
||||
connection con1;
|
||||
--error ER_DUP_ENTRY
|
||||
reap;
|
||||
SET DEBUG_SYNC='write_row_noreplace SIGNAL insert5 WAIT_FOR select5';
|
||||
--send
|
||||
LOAD DATA INFILE '../../std_data/loaddata5.dat' IGNORE INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (a, b);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert5';
|
||||
SELECT * FROM t1;
|
||||
# this should S-lock; no conflict
|
||||
SELECT * FROM t1 WHERE a=3 LOCK IN SHARE MODE;
|
||||
# this should X-lock, conflicting with the S-lock of the IGNORE in con1
|
||||
--send
|
||||
SELECT * FROM t1 WHERE a=3 FOR UPDATE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'statistics' and
|
||||
info = 'SELECT * FROM t1 WHERE a=3 FOR UPDATE';
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC='now SIGNAL select5';
|
||||
|
||||
connection con1;
|
||||
reap;
|
||||
connection default;
|
||||
reap;
|
||||
|
||||
connection con1;
|
||||
SET DEBUG_SYNC='write_row_replace SIGNAL insert6 WAIT_FOR select6';
|
||||
--send
|
||||
LOAD DATA INFILE '../../std_data/loaddata5.dat' REPLACE INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (a, b);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert6';
|
||||
SELECT * FROM t1;
|
||||
# this should conflict with the X-lock acquired by the REPLACE
|
||||
--send
|
||||
SELECT a,b FROM t1 LOCK IN SHARE MODE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'Sending data' and
|
||||
info = 'SELECT a,b FROM t1 LOCK IN SHARE MODE';
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC='now SIGNAL select6';
|
||||
|
||||
connection con1;
|
||||
reap;
|
||||
connection default;
|
||||
reap;
|
||||
|
||||
disconnect con1;
|
||||
disconnect con2;
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC='RESET';
|
||||
DROP TABLE t1;
|
@ -39,6 +39,81 @@ DELETE FROM t1_purge;
|
||||
DELETE FROM t2_purge;
|
||||
DELETE FROM t3_purge;
|
||||
DELETE FROM t4_purge;
|
||||
SET @r=REPEAT('a',500);
|
||||
CREATE TABLE t12637786(a INT,
|
||||
v1 VARCHAR(500), v2 VARCHAR(500), v3 VARCHAR(500),
|
||||
v4 VARCHAR(500), v5 VARCHAR(500), v6 VARCHAR(500),
|
||||
v7 VARCHAR(500), v8 VARCHAR(500), v9 VARCHAR(500),
|
||||
v10 VARCHAR(500), v11 VARCHAR(500), v12 VARCHAR(500),
|
||||
v13 VARCHAR(500), v14 VARCHAR(500), v15 VARCHAR(500),
|
||||
v16 VARCHAR(500), v17 VARCHAR(500), v18 VARCHAR(500)
|
||||
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
CREATE INDEX idx1 ON t12637786(a,v1);
|
||||
INSERT INTO t12637786 VALUES(9,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
|
||||
UPDATE t12637786 SET a=1000;
|
||||
DELETE FROM t12637786;
|
||||
create table t12963823(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob,
|
||||
i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob)
|
||||
engine=innodb row_format=dynamic;
|
||||
SET @r = repeat('a', 767);
|
||||
insert into t12963823 values (@r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r);
|
||||
create index ndx_a on t12963823 (a(500));
|
||||
create index ndx_b on t12963823 (b(500));
|
||||
create index ndx_c on t12963823 (c(500));
|
||||
create index ndx_d on t12963823 (d(500));
|
||||
create index ndx_e on t12963823 (e(500));
|
||||
create index ndx_f on t12963823 (f(500));
|
||||
create index ndx_k on t12963823 (k(500));
|
||||
create index ndx_l on t12963823 (l(500));
|
||||
SET @r = repeat('b', 500);
|
||||
update t12963823 set a=@r,b=@r,c=@r,d=@r;
|
||||
update t12963823 set e=@r,f=@r,g=@r,h=@r;
|
||||
update t12963823 set i=@r,j=@r,k=@r,l=@r;
|
||||
update t12963823 set m=@r,n=@r,o=@r,p=@r;
|
||||
alter table t12963823 drop index ndx_a;
|
||||
alter table t12963823 drop index ndx_b;
|
||||
create index ndx_g on t12963823 (g(500));
|
||||
create index ndx_h on t12963823 (h(500));
|
||||
create index ndx_i on t12963823 (i(500));
|
||||
create index ndx_j on t12963823 (j(500));
|
||||
create index ndx_m on t12963823 (m(500));
|
||||
create index ndx_n on t12963823 (n(500));
|
||||
create index ndx_o on t12963823 (o(500));
|
||||
create index ndx_p on t12963823 (p(500));
|
||||
show create table t12963823;
|
||||
Table Create Table
|
||||
t12963823 CREATE TABLE `t12963823` (
|
||||
`a` blob,
|
||||
`b` blob,
|
||||
`c` blob,
|
||||
`d` blob,
|
||||
`e` blob,
|
||||
`f` blob,
|
||||
`g` blob,
|
||||
`h` blob,
|
||||
`i` blob,
|
||||
`j` blob,
|
||||
`k` blob,
|
||||
`l` blob,
|
||||
`m` blob,
|
||||
`n` blob,
|
||||
`o` blob,
|
||||
`p` blob,
|
||||
KEY `ndx_c` (`c`(500)),
|
||||
KEY `ndx_d` (`d`(500)),
|
||||
KEY `ndx_e` (`e`(500)),
|
||||
KEY `ndx_f` (`f`(500)),
|
||||
KEY `ndx_k` (`k`(500)),
|
||||
KEY `ndx_l` (`l`(500)),
|
||||
KEY `ndx_g` (`g`(500)),
|
||||
KEY `ndx_h` (`h`(500)),
|
||||
KEY `ndx_i` (`i`(500)),
|
||||
KEY `ndx_j` (`j`(500)),
|
||||
KEY `ndx_m` (`m`(500)),
|
||||
KEY `ndx_n` (`n`(500)),
|
||||
KEY `ndx_o` (`o`(500)),
|
||||
KEY `ndx_p` (`p`(500))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
|
||||
set global innodb_file_per_table=0;
|
||||
set global innodb_file_format=Antelope;
|
||||
create table t1(a int not null, b int, c char(10) not null, d varchar(20)) engine = innodb;
|
||||
@ -1010,6 +1085,15 @@ ERROR HY000: Too big row
|
||||
alter table t1 row_format=compact;
|
||||
create index t1u on t1 (u(1));
|
||||
drop table t1;
|
||||
CREATE TABLE bug12547647(
|
||||
a INT NOT NULL, b BLOB NOT NULL, c TEXT,
|
||||
PRIMARY KEY (b(10), a), INDEX (c(10))
|
||||
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO bug12547647 VALUES (5,repeat('khdfo5AlOq',1900),repeat('g',7731));
|
||||
COMMIT;
|
||||
UPDATE bug12547647 SET c = REPEAT('b',16928);
|
||||
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 bug12547647;
|
||||
SET @r=REPEAT('a',500);
|
||||
CREATE TABLE t1(a INT,
|
||||
v1 VARCHAR(500), v2 VARCHAR(500), v3 VARCHAR(500),
|
||||
@ -1024,15 +1108,6 @@ INSERT INTO t1 VALUES(9,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
|
||||
UPDATE t1 SET a=1000;
|
||||
DELETE FROM t1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE bug12547647(
|
||||
a INT NOT NULL, b BLOB NOT NULL, c TEXT,
|
||||
PRIMARY KEY (b(10), a), INDEX (c(10))
|
||||
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO bug12547647 VALUES (5,repeat('khdfo5AlOq',1900),repeat('g',7731));
|
||||
COMMIT;
|
||||
UPDATE bug12547647 SET c = REPEAT('b',16928);
|
||||
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 bug12547647;
|
||||
set global innodb_file_per_table=0;
|
||||
set global innodb_file_format=Antelope;
|
||||
set global innodb_file_format_check=Antelope;
|
||||
@ -1237,3 +1312,5 @@ a b
|
||||
3 b
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge;
|
||||
DROP TABLE t12637786;
|
||||
DROP TABLE t12963823;
|
||||
|
@ -55,3 +55,20 @@ id x
|
||||
1 1
|
||||
2 10
|
||||
drop table t1;
|
||||
#
|
||||
#Bug#12842206 INNODB LOCKING REGRESSION FOR INSERT IGNORE
|
||||
#fixed by re-fixing Bug#7975
|
||||
#aka Bug#11759688 52020: InnoDB can still deadlock on just INSERT...
|
||||
#
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(3,1);
|
||||
BEGIN;
|
||||
INSERT IGNORE INTO t1 VALUES(3,14);
|
||||
BEGIN;
|
||||
INSERT IGNORE INTO t1 VALUES(3,23);
|
||||
SELECT * FROM t1 FOR UPDATE;
|
||||
COMMIT;
|
||||
a b
|
||||
3 1
|
||||
COMMIT;
|
||||
DROP TABLE t1;
|
||||
|
@ -1301,6 +1301,20 @@ ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fail
|
||||
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
|
||||
ERROR 42S22: Unknown column 't1.id' in 'where clause'
|
||||
drop table t3,t2,t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 VARCHAR(8), c2 VARCHAR(8),
|
||||
PRIMARY KEY (c1, c2)
|
||||
) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (
|
||||
c0 INT PRIMARY KEY,
|
||||
c1 VARCHAR(8) UNIQUE,
|
||||
FOREIGN KEY (c1) REFERENCES t1 (c1) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES ('old', 'somevalu'), ('other', 'anyvalue');
|
||||
INSERT INTO t2 VALUES (10, 'old'), (20, 'other');
|
||||
UPDATE t1 SET c1 = 'other' WHERE c1 = 'old';
|
||||
ERROR 23000: Upholding foreign key constraints for table 't1', entry 'other-somevalu', key 2 would lead to a duplicate entry
|
||||
DROP TABLE t2,t1;
|
||||
create table t1(
|
||||
id int primary key,
|
||||
pid int,
|
||||
@ -1679,7 +1693,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
|
||||
1067
|
||||
1071
|
||||
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
|
||||
866
|
||||
|
@ -126,5 +126,4 @@ Warning 1265 Data truncated for column 'col79' at row 1
|
||||
Warning 1264 Out of range value for column 'col84' at row 1
|
||||
DROP TABLE bug52745;
|
||||
SET GLOBAL innodb_file_format=Antelope;
|
||||
SET GLOBAL innodb_file_format_check=Antelope;
|
||||
SET GLOBAL innodb_file_per_table=0;
|
||||
|
@ -11,5 +11,4 @@ Error 139 Too big row
|
||||
Error 1118 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 bug53591;
|
||||
SET GLOBAL innodb_file_format=Antelope;
|
||||
SET GLOBAL innodb_file_format_check=Antelope;
|
||||
SET GLOBAL innodb_file_per_table=0;
|
||||
|
@ -0,0 +1,13 @@
|
||||
set global innodb_file_per_table=on;
|
||||
set global innodb_file_format=`1`;
|
||||
create table t1(a text) engine=innodb key_block_size=8;
|
||||
SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0;
|
||||
page_size
|
||||
8192
|
||||
drop table t1;
|
||||
SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0;
|
||||
page_size
|
||||
create table t2(a text) engine=innodb;
|
||||
SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0;
|
||||
page_size
|
||||
drop table t2;
|
882
mysql-test/suite/innodb_plugin/r/innodb_misc1.result
Normal file
882
mysql-test/suite/innodb_plugin/r/innodb_misc1.result
Normal file
@ -0,0 +1,882 @@
|
||||
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 42000: Incorrect column name 'DB_ROW_ID'
|
||||
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;
|
||||
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),
|
||||
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
|
||||
SET innodb_strict_mode=OFF;
|
||||
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
|
77
mysql-test/suite/innodb_plugin/r/innodb_replace.result
Normal file
77
mysql-test/suite/innodb_plugin/r/innodb_replace.result
Normal file
@ -0,0 +1,77 @@
|
||||
#
|
||||
#Bug#11759688 52020: InnoDB can still deadlock
|
||||
#on just INSERT...ON DUPLICATE KEY
|
||||
#a.k.a. Bug#7975 deadlock without any locking, simple select and update
|
||||
#
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(3,1);
|
||||
BEGIN;
|
||||
SET DEBUG_SYNC='write_row_noreplace SIGNAL insert1 WAIT_FOR select1';
|
||||
INSERT INTO t1 VALUES(3,2);
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert1';
|
||||
SELECT * FROM t1 LOCK IN SHARE MODE;
|
||||
a b
|
||||
3 1
|
||||
SELECT * FROM t1 FOR UPDATE;
|
||||
SET DEBUG_SYNC='now SIGNAL select1';
|
||||
ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
|
||||
INSERT INTO t1 VALUES(3,3) ON DUPLICATE KEY UPDATE b=b+10;
|
||||
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
|
||||
COMMIT;
|
||||
SET DEBUG_SYNC='write_row_replace SIGNAL insert2 WAIT_FOR select2';
|
||||
REPLACE INTO t1 VALUES(3,4);
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert2';
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
3 11
|
||||
SELECT * FROM t1 LOCK IN SHARE MODE;
|
||||
SET DEBUG_SYNC='now SIGNAL select2';
|
||||
SET DEBUG_SYNC='write_row_replace SIGNAL insert3 WAIT_FOR select3';
|
||||
INSERT INTO t1 VALUES(3,5) ON DUPLICATE KEY UPDATE b=b+20;
|
||||
a b
|
||||
3 4
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert3';
|
||||
SELECT b FROM t1 LOCK IN SHARE MODE;
|
||||
SET DEBUG_SYNC='now SIGNAL select3';
|
||||
b
|
||||
24
|
||||
SET DEBUG_SYNC='write_row_noreplace SIGNAL insert4 WAIT_FOR select4';
|
||||
LOAD DATA INFILE '../../std_data/loaddata5.dat' INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (a, b);
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert4';
|
||||
SELECT b FROM t1 WHERE a=3 LOCK IN SHARE MODE;
|
||||
b
|
||||
24
|
||||
SELECT b FROM t1 WHERE a=3 FOR UPDATE;
|
||||
SET DEBUG_SYNC='now SIGNAL select4';
|
||||
b
|
||||
24
|
||||
ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
|
||||
SET DEBUG_SYNC='write_row_noreplace SIGNAL insert5 WAIT_FOR select5';
|
||||
LOAD DATA INFILE '../../std_data/loaddata5.dat' IGNORE INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (a, b);
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert5';
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
3 24
|
||||
SELECT * FROM t1 WHERE a=3 LOCK IN SHARE MODE;
|
||||
a b
|
||||
3 24
|
||||
SELECT * FROM t1 WHERE a=3 FOR UPDATE;
|
||||
SET DEBUG_SYNC='now SIGNAL select5';
|
||||
a b
|
||||
3 24
|
||||
SET DEBUG_SYNC='write_row_replace SIGNAL insert6 WAIT_FOR select6';
|
||||
LOAD DATA INFILE '../../std_data/loaddata5.dat' REPLACE INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (a, b);
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert6';
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 2
|
||||
3 24
|
||||
5 6
|
||||
SELECT a,b FROM t1 LOCK IN SHARE MODE;
|
||||
SET DEBUG_SYNC='now SIGNAL select6';
|
||||
a b
|
||||
1 2
|
||||
3 4
|
||||
5 6
|
||||
SET DEBUG_SYNC='RESET';
|
||||
DROP TABLE t1;
|
@ -11,4 +11,6 @@
|
||||
##############################################################################
|
||||
|
||||
innodb_bug52745: Disabled as this has valgrind failures (also in MySQL 5.1.50)
|
||||
innodb-index: Disabled until merging with XtraDB 5.1.60
|
||||
innodb-index: Disabled until merging with XtraDB 5.1.60
|
||||
innodb-lock: Disabled until merging with XtraDB 5.1.60
|
||||
innodb_replace: Disabled until merging with XtraDB 5.1.60
|
||||
|
@ -2,8 +2,6 @@
|
||||
# embedded server ignores 'delayed', so skip this
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
@ -20,10 +18,3 @@ SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES(null);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# restore environment to the state it was before this test execution
|
||||
#
|
||||
|
||||
-- disable_query_log
|
||||
eval set global innodb_file_format_check=$innodb_file_format_check_orig;
|
||||
|
@ -2,8 +2,6 @@
|
||||
# embedded server ignores 'delayed', so skip this
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
@ -34,10 +32,3 @@ SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES(null);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# restore environment to the state it was before this test execution
|
||||
#
|
||||
|
||||
-- disable_query_log
|
||||
eval set global innodb_file_format_check=$innodb_file_format_check_orig;
|
||||
|
@ -1,7 +1,5 @@
|
||||
-- source include/have_innodb_plugin.inc
|
||||
|
||||
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
|
||||
|
||||
##
|
||||
# Bug #56228: dropping tables from within an active statement crashes server
|
||||
#
|
||||
@ -33,10 +31,3 @@ SELECT bug56228();
|
||||
DROP FUNCTION bug56228;
|
||||
DROP TEMPORARY TABLE t2_56228;
|
||||
DROP TEMPORARY TABLE IF EXISTS t1_56228;
|
||||
|
||||
#
|
||||
# restore environment to the state it was before this test execution
|
||||
#
|
||||
|
||||
-- disable_query_log
|
||||
eval set global innodb_file_format_check=$innodb_file_format_check_orig;
|
||||
|
@ -2,8 +2,6 @@
|
||||
# embedded server ignores 'delayed', so skip this
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
@ -639,10 +637,3 @@ INSERT INTO t1 VALUES (18446744073709551615);
|
||||
-- source include/restart_mysqld.inc
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# restore environment to the state it was before this test execution
|
||||
#
|
||||
|
||||
-- disable_query_log
|
||||
eval set global innodb_file_format_check=$innodb_file_format_check_orig;
|
||||
|
@ -61,7 +61,6 @@ SET storage_engine=InnoDB;
|
||||
--disable_query_log
|
||||
# These values can change during the test
|
||||
LET $innodb_file_format_orig=`select @@innodb_file_format`;
|
||||
LET $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
|
||||
LET $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
|
||||
LET $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
|
||||
--enable_query_log
|
||||
@ -568,7 +567,6 @@ DROP TABLE IF EXISTS t1;
|
||||
|
||||
--disable_query_log
|
||||
EVAL SET GLOBAL innodb_file_format=$innodb_file_format_orig;
|
||||
EVAL SET GLOBAL innodb_file_format_check=$innodb_file_format_check_orig;
|
||||
EVAL SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
|
||||
EVAL SET SESSION innodb_strict_mode=$innodb_strict_mode_orig;
|
||||
--enable_query_log
|
||||
|
@ -2,14 +2,12 @@
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
|
||||
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
|
||||
|
||||
let $per_table=`select @@innodb_file_per_table`;
|
||||
let $format=`select @@innodb_file_format`;
|
||||
set global innodb_file_per_table=on;
|
||||
set global innodb_file_format='Barracuda';
|
||||
|
||||
# Test an assertion failure on purge.
|
||||
# Bug #12429576 - Test an assertion failure on purge.
|
||||
CREATE TABLE t1_purge (
|
||||
A INT,
|
||||
B BLOB, C BLOB, D BLOB, E BLOB,
|
||||
@ -59,6 +57,68 @@ DELETE FROM t1_purge;
|
||||
DELETE FROM t2_purge;
|
||||
DELETE FROM t3_purge;
|
||||
DELETE FROM t4_purge;
|
||||
# Instead of doing a --sleep 10, wait until the rest of the tests in
|
||||
# this file complete before dropping the tables. By then, the purge thread
|
||||
# will have delt with the updates above.
|
||||
|
||||
# Bug#12637786 - Bad assert by purge thread for records with external data
|
||||
# used in secondary indexes.
|
||||
SET @r=REPEAT('a',500);
|
||||
CREATE TABLE t12637786(a INT,
|
||||
v1 VARCHAR(500), v2 VARCHAR(500), v3 VARCHAR(500),
|
||||
v4 VARCHAR(500), v5 VARCHAR(500), v6 VARCHAR(500),
|
||||
v7 VARCHAR(500), v8 VARCHAR(500), v9 VARCHAR(500),
|
||||
v10 VARCHAR(500), v11 VARCHAR(500), v12 VARCHAR(500),
|
||||
v13 VARCHAR(500), v14 VARCHAR(500), v15 VARCHAR(500),
|
||||
v16 VARCHAR(500), v17 VARCHAR(500), v18 VARCHAR(500)
|
||||
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
CREATE INDEX idx1 ON t12637786(a,v1);
|
||||
INSERT INTO t12637786 VALUES(9,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
|
||||
UPDATE t12637786 SET a=1000;
|
||||
DELETE FROM t12637786;
|
||||
# We need to activate the purge thread at this point to make sure it does not
|
||||
# assert and is able to clean up the old versions of secondary index entries.
|
||||
# But instead of doing a --sleep 10, wait until the rest of the tests in
|
||||
# this file complete before dropping the table. By then, the purge thread
|
||||
# will have delt with the updates above.
|
||||
|
||||
# Bug#12963823 - Test that the purge thread does not crash when
|
||||
# the number of indexes has changed since the UNDO record was logged.
|
||||
create table t12963823(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob,
|
||||
i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob)
|
||||
engine=innodb row_format=dynamic;
|
||||
SET @r = repeat('a', 767);
|
||||
insert into t12963823 values (@r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r);
|
||||
create index ndx_a on t12963823 (a(500));
|
||||
create index ndx_b on t12963823 (b(500));
|
||||
create index ndx_c on t12963823 (c(500));
|
||||
create index ndx_d on t12963823 (d(500));
|
||||
create index ndx_e on t12963823 (e(500));
|
||||
create index ndx_f on t12963823 (f(500));
|
||||
create index ndx_k on t12963823 (k(500));
|
||||
create index ndx_l on t12963823 (l(500));
|
||||
|
||||
SET @r = repeat('b', 500);
|
||||
update t12963823 set a=@r,b=@r,c=@r,d=@r;
|
||||
update t12963823 set e=@r,f=@r,g=@r,h=@r;
|
||||
update t12963823 set i=@r,j=@r,k=@r,l=@r;
|
||||
update t12963823 set m=@r,n=@r,o=@r,p=@r;
|
||||
alter table t12963823 drop index ndx_a;
|
||||
alter table t12963823 drop index ndx_b;
|
||||
create index ndx_g on t12963823 (g(500));
|
||||
create index ndx_h on t12963823 (h(500));
|
||||
create index ndx_i on t12963823 (i(500));
|
||||
create index ndx_j on t12963823 (j(500));
|
||||
create index ndx_m on t12963823 (m(500));
|
||||
create index ndx_n on t12963823 (n(500));
|
||||
create index ndx_o on t12963823 (o(500));
|
||||
create index ndx_p on t12963823 (p(500));
|
||||
show create table t12963823;
|
||||
# We need to activate the purge thread at this point to see if it crashes
|
||||
# but instead of doing a --sleep 10, wait until the rest of the tests in
|
||||
# this file complete before dropping the table. By then, the purge thread
|
||||
# will have delt with the updates above.
|
||||
|
||||
|
||||
eval set global innodb_file_per_table=$per_table;
|
||||
eval set global innodb_file_format=$format;
|
||||
@ -462,6 +522,17 @@ create index t1u on t1 (u(1));
|
||||
|
||||
drop table t1;
|
||||
|
||||
# Bug#12547647 UPDATE LOGGING COULD EXCEED LOG PAGE SIZE
|
||||
CREATE TABLE bug12547647(
|
||||
a INT NOT NULL, b BLOB NOT NULL, c TEXT,
|
||||
PRIMARY KEY (b(10), a), INDEX (c(10))
|
||||
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO bug12547647 VALUES (5,repeat('khdfo5AlOq',1900),repeat('g',7731));
|
||||
COMMIT;
|
||||
# The following used to cause infinite undo log allocation.
|
||||
--error ER_TOO_BIG_ROWSIZE
|
||||
UPDATE bug12547647 SET c = REPEAT('b',16928);
|
||||
DROP TABLE bug12547647;
|
||||
# Bug#12637786
|
||||
SET @r=REPEAT('a',500);
|
||||
CREATE TABLE t1(a INT,
|
||||
@ -472,6 +543,7 @@ CREATE TABLE t1(a INT,
|
||||
v13 VARCHAR(500), v14 VARCHAR(500), v15 VARCHAR(500),
|
||||
v16 VARCHAR(500), v17 VARCHAR(500), v18 VARCHAR(500)
|
||||
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
|
||||
CREATE INDEX idx1 ON t1(a,v1);
|
||||
INSERT INTO t1 VALUES(9,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
|
||||
UPDATE t1 SET a=1000;
|
||||
@ -480,19 +552,6 @@ DELETE FROM t1;
|
||||
-- sleep 10
|
||||
DROP TABLE t1;
|
||||
|
||||
# Bug#12547647 UPDATE LOGGING COULD EXCEED LOG PAGE SIZE
|
||||
CREATE TABLE bug12547647(
|
||||
a INT NOT NULL, b BLOB NOT NULL, c TEXT,
|
||||
PRIMARY KEY (b(10), a), INDEX (c(10))
|
||||
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
|
||||
INSERT INTO bug12547647 VALUES (5,repeat('khdfo5AlOq',1900),repeat('g',7731));
|
||||
COMMIT;
|
||||
# The following used to cause infinite undo log allocation.
|
||||
--error ER_TOO_BIG_ROWSIZE
|
||||
UPDATE bug12547647 SET c = REPEAT('b',16928);
|
||||
DROP TABLE bug12547647;
|
||||
|
||||
eval set global innodb_file_per_table=$per_table;
|
||||
eval set global innodb_file_format=$format;
|
||||
eval set global innodb_file_format_check=$format;
|
||||
@ -630,11 +689,9 @@ disconnect a;
|
||||
disconnect b;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# Drop these tables since the purge thread must have run by now
|
||||
# and did not crash.
|
||||
DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge;
|
||||
|
||||
#
|
||||
# restore environment to the state it was before this test execution
|
||||
#
|
||||
|
||||
-- disable_query_log
|
||||
eval SET GLOBAL innodb_file_format_check=$innodb_file_format_check_orig;
|
||||
DROP TABLE t12637786;
|
||||
DROP TABLE t12963823;
|
||||
|
@ -100,3 +100,44 @@ select * from t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
--echo #
|
||||
--echo #Bug#12842206 INNODB LOCKING REGRESSION FOR INSERT IGNORE
|
||||
--echo #fixed by re-fixing Bug#7975
|
||||
--echo #aka Bug#11759688 52020: InnoDB can still deadlock on just INSERT...
|
||||
--echo #
|
||||
|
||||
connection default;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 VALUES(3,1);
|
||||
|
||||
BEGIN;
|
||||
# this used to wrongly acquire an X lock; now it takes an S lock
|
||||
INSERT IGNORE INTO t1 VALUES(3,14);
|
||||
|
||||
connection con1;
|
||||
BEGIN;
|
||||
# this used to wrongly acquire an X lock; now it takes an S lock
|
||||
INSERT IGNORE INTO t1 VALUES(3,23);
|
||||
--send
|
||||
SELECT * FROM t1 FOR UPDATE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'Sending data' and
|
||||
info = 'SELECT * FROM t1 FOR UPDATE';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
connection default;
|
||||
COMMIT;
|
||||
connection con1;
|
||||
reap;
|
||||
COMMIT;
|
||||
disconnect con1;
|
||||
disconnect con2;
|
||||
|
||||
connection default;
|
||||
DROP TABLE t1;
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
let $per_table=`select @@innodb_file_per_table`;
|
||||
let $format=`select @@innodb_file_format`;
|
||||
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
|
||||
set global innodb_file_per_table=off;
|
||||
set global innodb_file_format=`0`;
|
||||
|
||||
@ -337,4 +336,3 @@ drop table normal_table, zip_table;
|
||||
-- disable_query_log
|
||||
eval set global innodb_file_format=$format;
|
||||
eval set global innodb_file_per_table=$per_table;
|
||||
eval set global innodb_file_format_check=$innodb_file_format_check_orig;
|
||||
|
@ -1042,6 +1042,24 @@ update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id
|
||||
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
|
||||
drop table t3,t2,t1;
|
||||
|
||||
# test ON UPDATE CASCADE
|
||||
CREATE TABLE t1 (
|
||||
c1 VARCHAR(8), c2 VARCHAR(8),
|
||||
PRIMARY KEY (c1, c2)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE t2 (
|
||||
c0 INT PRIMARY KEY,
|
||||
c1 VARCHAR(8) UNIQUE,
|
||||
FOREIGN KEY (c1) REFERENCES t1 (c1) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 VALUES ('old', 'somevalu'), ('other', 'anyvalue');
|
||||
INSERT INTO t2 VALUES (10, 'old'), (20, 'other');
|
||||
-- error ER_FOREIGN_DUPLICATE_KEY
|
||||
UPDATE t1 SET c1 = 'other' WHERE c1 = 'old';
|
||||
DROP TABLE t2,t1;
|
||||
|
||||
#
|
||||
# test for recursion depth limit
|
||||
#
|
||||
|
@ -15,7 +15,6 @@ SET storage_engine=InnoDB;
|
||||
-- disable_result_log
|
||||
|
||||
let $file_format=`select @@innodb_file_format`;
|
||||
let $file_format_check=`select @@innodb_file_format_check`;
|
||||
let $file_per_table=`select @@innodb_file_per_table`;
|
||||
SET GLOBAL innodb_file_format='Barracuda';
|
||||
SET GLOBAL innodb_file_per_table=on;
|
||||
@ -28,5 +27,4 @@ INSERT IGNORE INTO `table0` SET `col19` = '19940127002709', `col20` = 2383927.90
|
||||
CHECK TABLE table0 EXTENDED;
|
||||
DROP TABLE table0;
|
||||
EVAL SET GLOBAL innodb_file_format=$file_format;
|
||||
EVAL SET GLOBAL innodb_file_format_check=$file_format_check;
|
||||
EVAL SET GLOBAL innodb_file_per_table=$file_per_table;
|
||||
|
@ -0,0 +1 @@
|
||||
--force-restart
|
@ -3,7 +3,6 @@ let collation=utf8_persian_ci;
|
||||
--source include/have_collation.inc
|
||||
|
||||
let $file_format=`select @@innodb_file_format`;
|
||||
let $file_format_check=`select @@innodb_file_format_check`;
|
||||
let $file_per_table=`select @@innodb_file_per_table`;
|
||||
SET GLOBAL innodb_file_format='Barracuda';
|
||||
SET GLOBAL innodb_file_per_table=on;
|
||||
@ -107,5 +106,4 @@ SHOW WARNINGS;
|
||||
DROP TABLE bug52745;
|
||||
|
||||
EVAL SET GLOBAL innodb_file_format=$file_format;
|
||||
EVAL SET GLOBAL innodb_file_format_check=$file_format_check;
|
||||
EVAL SET GLOBAL innodb_file_per_table=$file_per_table;
|
||||
|
@ -4,7 +4,6 @@
|
||||
-- source include/have_innodb_plugin.inc
|
||||
|
||||
let $file_format=`select @@innodb_file_format`;
|
||||
let $file_format_check=`select @@innodb_file_format_check`;
|
||||
let $file_per_table=`select @@innodb_file_per_table`;
|
||||
|
||||
SET GLOBAL innodb_file_format='Barracuda';
|
||||
@ -21,5 +20,4 @@ SHOW WARNINGS;
|
||||
DROP TABLE bug53591;
|
||||
|
||||
EVAL SET GLOBAL innodb_file_format=$file_format;
|
||||
EVAL SET GLOBAL innodb_file_format_check=$file_format_check;
|
||||
EVAL SET GLOBAL innodb_file_per_table=$file_per_table;
|
||||
|
@ -8,7 +8,6 @@
|
||||
SET @tx_isolation_orig = @@tx_isolation;
|
||||
SET @innodb_file_per_table_orig = @@innodb_file_per_table;
|
||||
SET @innodb_file_format_orig = @@innodb_file_format;
|
||||
SET @innodb_file_format_check_orig = @@innodb_file_format_check;
|
||||
# The flag innodb_change_buffering_debug is only available in debug builds.
|
||||
# It instructs InnoDB to try to evict pages from the buffer pool when
|
||||
# change buffering is possible, so that the change buffer will be used
|
||||
@ -138,6 +137,5 @@ DROP TABLE bug56680;
|
||||
SET GLOBAL tx_isolation = @tx_isolation_orig;
|
||||
SET GLOBAL innodb_file_per_table = @innodb_file_per_table_orig;
|
||||
SET GLOBAL innodb_file_format = @innodb_file_format_orig;
|
||||
SET GLOBAL innodb_file_format_check = @innodb_file_format_check_orig;
|
||||
-- error 0, ER_UNKNOWN_SYSTEM_VARIABLE
|
||||
SET GLOBAL innodb_change_buffering_debug = @innodb_change_buffering_debug_orig;
|
||||
|
@ -3,8 +3,6 @@
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_innodb_plugin.inc
|
||||
|
||||
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
|
||||
|
||||
# Close tables used by other tests (to not get crashed myisam tables)
|
||||
flush tables;
|
||||
|
||||
@ -69,5 +67,3 @@ XA COMMIT '789';
|
||||
SELECT * FROM t;
|
||||
|
||||
DROP TABLE t;
|
||||
--disable_query_log
|
||||
eval set global innodb_file_format_check=$innodb_file_format_check_orig;
|
||||
|
@ -0,0 +1 @@
|
||||
--innodb-buffer-pool-size=8M
|
59
mysql-test/suite/innodb_plugin/t/innodb_cmp_drop_table.test
Normal file
59
mysql-test/suite/innodb_plugin/t/innodb_cmp_drop_table.test
Normal file
@ -0,0 +1,59 @@
|
||||
-- source include/have_innodb_plugin.inc
|
||||
|
||||
let $per_table=`select @@innodb_file_per_table`;
|
||||
let $format=`select @@innodb_file_format`;
|
||||
|
||||
-- let $query_i_s = SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0
|
||||
|
||||
set global innodb_file_per_table=on;
|
||||
set global innodb_file_format=`1`;
|
||||
|
||||
create table t1(a text) engine=innodb key_block_size=8;
|
||||
|
||||
-- disable_query_log
|
||||
|
||||
# insert some rows so we are using compressed pages
|
||||
-- let $i = 10
|
||||
while ($i)
|
||||
{
|
||||
insert into t1 values(repeat('abcdefghijklmnopqrstuvwxyz',100));
|
||||
dec $i;
|
||||
}
|
||||
-- enable_query_log
|
||||
|
||||
# we should be using some 8K pages
|
||||
-- eval $query_i_s
|
||||
|
||||
drop table t1;
|
||||
|
||||
# no lazy eviction at drop table in 5.1 there should still be no
|
||||
# used 8K pages
|
||||
-- eval $query_i_s
|
||||
|
||||
# create a non-compressed table and insert enough into it to evict
|
||||
# compressed pages
|
||||
create table t2(a text) engine=innodb;
|
||||
|
||||
-- disable_query_log
|
||||
|
||||
-- let $i = 200
|
||||
while ($i)
|
||||
{
|
||||
insert into t2 values(repeat('abcdefghijklmnopqrstuvwxyz',1000));
|
||||
dec $i;
|
||||
}
|
||||
|
||||
-- enable_query_log
|
||||
|
||||
# now there should be no 8K pages in the buffer pool
|
||||
-- eval $query_i_s
|
||||
|
||||
drop table t2;
|
||||
|
||||
#
|
||||
# restore environment to the state it was before this test execution
|
||||
#
|
||||
|
||||
-- disable_query_log
|
||||
eval set global innodb_file_format=$format;
|
||||
eval set global innodb_file_per_table=$per_table;
|
@ -0,0 +1 @@
|
||||
--force-restart
|
1
mysql-test/suite/innodb_plugin/t/innodb_misc1-master.opt
Normal file
1
mysql-test/suite/innodb_plugin/t/innodb_misc1-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--binlog_cache_size=32768 --innodb_lock_wait_timeout=1
|
1178
mysql-test/suite/innodb_plugin/t/innodb_misc1.test
Normal file
1178
mysql-test/suite/innodb_plugin/t/innodb_misc1.test
Normal file
File diff suppressed because it is too large
Load Diff
186
mysql-test/suite/innodb_plugin/t/innodb_replace.test
Normal file
186
mysql-test/suite/innodb_plugin/t/innodb_replace.test
Normal file
@ -0,0 +1,186 @@
|
||||
--source include/have_innodb_plugin.inc
|
||||
--source include/have_debug_sync.inc
|
||||
|
||||
--echo #
|
||||
--echo #Bug#11759688 52020: InnoDB can still deadlock
|
||||
--echo #on just INSERT...ON DUPLICATE KEY
|
||||
--echo #a.k.a. Bug#7975 deadlock without any locking, simple select and update
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 VALUES(3,1);
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
connect (con2,localhost,root,,);
|
||||
connection con1;
|
||||
|
||||
BEGIN;
|
||||
# normal INSERT of a duplicate should only S-lock the existing record (3,1)
|
||||
SET DEBUG_SYNC='write_row_noreplace SIGNAL insert1 WAIT_FOR select1';
|
||||
--send
|
||||
INSERT INTO t1 VALUES(3,2);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert1';
|
||||
# this should S-lock (3,1); no conflict
|
||||
SELECT * FROM t1 LOCK IN SHARE MODE;
|
||||
# this should X-lock (3,1), conflicting with con1
|
||||
--send
|
||||
SELECT * FROM t1 FOR UPDATE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'Sending data' and
|
||||
info = 'SELECT * FROM t1 FOR UPDATE';
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC='now SIGNAL select1';
|
||||
|
||||
connection con1;
|
||||
--error ER_DUP_ENTRY
|
||||
reap;
|
||||
# We are still holding an S-lock on (3,1) after the failed INSERT.
|
||||
# The following will upgrade it to an X-lock, causing a deadlock.
|
||||
# InnoDB should resolve the deadlock by aborting the blocked SELECT.
|
||||
INSERT INTO t1 VALUES(3,3) ON DUPLICATE KEY UPDATE b=b+10;
|
||||
|
||||
connection default;
|
||||
--error ER_LOCK_DEADLOCK
|
||||
reap;
|
||||
connection con1;
|
||||
COMMIT;
|
||||
|
||||
SET DEBUG_SYNC='write_row_replace SIGNAL insert2 WAIT_FOR select2';
|
||||
--send
|
||||
REPLACE INTO t1 VALUES(3,4);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert2';
|
||||
SELECT * FROM t1;
|
||||
--send
|
||||
SELECT * FROM t1 LOCK IN SHARE MODE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked because of X lock.
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'Sending data' and
|
||||
info = 'SELECT * FROM t1 LOCK IN SHARE MODE';
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC='now SIGNAL select2';
|
||||
|
||||
connection con1;
|
||||
reap;
|
||||
|
||||
SET DEBUG_SYNC='write_row_replace SIGNAL insert3 WAIT_FOR select3';
|
||||
--send
|
||||
INSERT INTO t1 VALUES(3,5) ON DUPLICATE KEY UPDATE b=b+20;
|
||||
|
||||
connection default;
|
||||
reap;
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert3';
|
||||
--send
|
||||
SELECT b FROM t1 LOCK IN SHARE MODE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked because of X lock.
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'Sending data' and
|
||||
info = 'SELECT b FROM t1 LOCK IN SHARE MODE';
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC='now SIGNAL select3';
|
||||
|
||||
connection default;
|
||||
reap;
|
||||
|
||||
connection con1;
|
||||
reap;
|
||||
SET DEBUG_SYNC='write_row_noreplace SIGNAL insert4 WAIT_FOR select4';
|
||||
--send
|
||||
LOAD DATA INFILE '../../std_data/loaddata5.dat' INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (a, b);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert4';
|
||||
# this should S-lock (3,1); no conflict
|
||||
SELECT b FROM t1 WHERE a=3 LOCK IN SHARE MODE;
|
||||
# this should X-lock (3,1), conflicting with con1
|
||||
--send
|
||||
SELECT b FROM t1 WHERE a=3 FOR UPDATE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'statistics' and
|
||||
info = 'SELECT b FROM t1 WHERE a=3 FOR UPDATE';
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC='now SIGNAL select4';
|
||||
|
||||
connection default;
|
||||
reap;
|
||||
|
||||
connection con1;
|
||||
--error ER_DUP_ENTRY
|
||||
reap;
|
||||
SET DEBUG_SYNC='write_row_noreplace SIGNAL insert5 WAIT_FOR select5';
|
||||
--send
|
||||
LOAD DATA INFILE '../../std_data/loaddata5.dat' IGNORE INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (a, b);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert5';
|
||||
SELECT * FROM t1;
|
||||
# this should S-lock; no conflict
|
||||
SELECT * FROM t1 WHERE a=3 LOCK IN SHARE MODE;
|
||||
# this should X-lock, conflicting with the S-lock of the IGNORE in con1
|
||||
--send
|
||||
SELECT * FROM t1 WHERE a=3 FOR UPDATE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'statistics' and
|
||||
info = 'SELECT * FROM t1 WHERE a=3 FOR UPDATE';
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC='now SIGNAL select5';
|
||||
|
||||
connection con1;
|
||||
reap;
|
||||
connection default;
|
||||
reap;
|
||||
|
||||
connection con1;
|
||||
SET DEBUG_SYNC='write_row_replace SIGNAL insert6 WAIT_FOR select6';
|
||||
--send
|
||||
LOAD DATA INFILE '../../std_data/loaddata5.dat' REPLACE INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (a, b);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert6';
|
||||
SELECT * FROM t1;
|
||||
# this should conflict with the X-lock acquired by the REPLACE
|
||||
--send
|
||||
SELECT a,b FROM t1 LOCK IN SHARE MODE;
|
||||
|
||||
connection con2;
|
||||
# Check that the above SELECT is blocked
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'Sending data' and
|
||||
info = 'SELECT a,b FROM t1 LOCK IN SHARE MODE';
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC='now SIGNAL select6';
|
||||
|
||||
connection con1;
|
||||
reap;
|
||||
connection default;
|
||||
reap;
|
||||
|
||||
disconnect con1;
|
||||
disconnect con2;
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC='RESET';
|
||||
DROP TABLE t1;
|
@ -41,7 +41,7 @@ id name id name
|
||||
SET @@session.max_join_size=8;
|
||||
## Since total joins are more than max_join_size value so error will occur ##
|
||||
SELECT * FROM t1 INNER JOIN t2 ON t1.id = t2.id;
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
'#--------------------FN_DYNVARS_079_03-------------------------#'
|
||||
## Setting global value of variable ##
|
||||
SET @@global.max_join_size=8;
|
||||
@ -52,7 +52,7 @@ SELECT @@global.max_join_size;
|
||||
8
|
||||
## Since total joins are more than max_join_size value so error will occur ##
|
||||
SELECT * FROM t1 INNER JOIN t2 ON t1.id = t2.id;
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
## Dropping both the tables ##
|
||||
Drop table t1, t2;
|
||||
## Restoring values ##
|
||||
|
@ -19,7 +19,7 @@ INSERT INTO t2 VALUES('aa4','bb');
|
||||
'#--------------------FN_DYNVARS_154_01-------------------------#'
|
||||
Expected error "Too big select"
|
||||
SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a;
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
Expected error The SELECT would examine more than MAX_JOIN_SIZE rows.
|
||||
'#--------------------FN_DYNVARS_154_02-------------------------#'
|
||||
SET SESSION SQL_BIG_SELECTS = 1;
|
||||
|
@ -17,7 +17,7 @@ INSERT INTO t2 VALUES('aa4','bb');
|
||||
'#--------------------FN_DYNVARS_161_01-------------------------#'
|
||||
SET SESSION sql_max_join_size=9;
|
||||
SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a;
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
Expected error The SELECT would examine more than MAX_JOIN_SIZE rows.
|
||||
'#--------------------FN_DYNVARS_161_02-------------------------#'
|
||||
SET SESSION SQL_BIG_SELECTS = 1;
|
||||
|
@ -89,6 +89,20 @@ SET SESSION debug = DEFAULT;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug#11747970 34660: CRASH WHEN FEDERATED TABLE LOSES CONNECTION DURING INSERT ... SELECT
|
||||
--echo #
|
||||
CREATE TABLE t1(f1 INT, KEY(f1));
|
||||
CREATE TABLE t2(f1 INT);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
SET SESSION debug='d,bug11747970_simulate_error';
|
||||
INSERT IGNORE INTO t2 SELECT f1 FROM t1 a WHERE NOT EXISTS (SELECT 1 FROM t2 b WHERE a.f1 = b.f1);
|
||||
SET SESSION debug = DEFAULT;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.1 tests
|
||||
--echo #
|
||||
|
@ -459,7 +459,7 @@ drop table t1;
|
||||
#
|
||||
create table t1 (c char(10)) engine=memory;
|
||||
create table t2 (c varchar(10)) engine=memory;
|
||||
--replace_column 8 #
|
||||
--replace_column 8 # 12 #
|
||||
show table status like 't_';
|
||||
drop table t1, t2;
|
||||
|
||||
|
@ -1,45 +0,0 @@
|
||||
# This is the unit test for bug *47167.
|
||||
# It tests setting the global variable
|
||||
# "innodb_file_format_check" with a
|
||||
# user-Defined Variable.
|
||||
|
||||
--source include/have_innodb.inc
|
||||
|
||||
# Save the value (Antelope) in 'innodb_file_format_check' to
|
||||
# 'old_innodb_file_format_check'
|
||||
set @old_innodb_file_format_check=@@innodb_file_format_check;
|
||||
|
||||
# @old_innodb_file_format_check shall have the value of 'Antelope'
|
||||
select @old_innodb_file_format_check;
|
||||
|
||||
# Reset the value in 'innodb_file_format_check' to 'Barracuda'
|
||||
set global innodb_file_format_check = Barracuda;
|
||||
|
||||
select @@innodb_file_format_check;
|
||||
|
||||
# Set 'innodb_file_format_check' to its default value, which
|
||||
# is the latest file format supported in the current release.
|
||||
set global innodb_file_format_check = DEFAULT;
|
||||
|
||||
select @@innodb_file_format_check;
|
||||
|
||||
# Put the saved value back to 'innodb_file_format_check'
|
||||
set global innodb_file_format_check = @old_innodb_file_format_check;
|
||||
|
||||
# Check whether 'innodb_file_format_check' get its original value.
|
||||
select @@innodb_file_format_check;
|
||||
|
||||
# Following are negative tests, all should fail.
|
||||
--disable_warnings
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
set global innodb_file_format_check = cheetah;
|
||||
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
set global innodb_file_format_check = Bear;
|
||||
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
set global innodb_file_format_check = on;
|
||||
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
set global innodb_file_format_check = off;
|
||||
--enable_warnings
|
@ -1692,4 +1692,22 @@ DROP TABLE t1;
|
||||
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
|
||||
SET myisam_repair_threads=@@global.myisam_repair_threads;
|
||||
|
||||
--echo #
|
||||
--echo # BUG#11757032 - 49030: OPTIMIZE TABLE BREAKS MYISAM TABLE WHEN
|
||||
--echo # USING MYISAM_USE_MMAP ON WINDOWS
|
||||
--echo #
|
||||
SET GLOBAL myisam_use_mmap=1;
|
||||
CREATE TABLE t1(a INT);
|
||||
INSERT INTO t1 VALUES(1),(2);
|
||||
DELETE FROM t1 WHERE a=1;
|
||||
FLUSH TABLE t1;
|
||||
LOCK TABLE t1 WRITE;
|
||||
OPTIMIZE TABLE t1;
|
||||
INSERT INTO t1 VALUES(3);
|
||||
UNLOCK TABLES;
|
||||
SELECT * FROM t1;
|
||||
CHECK TABLE t1;
|
||||
DROP TABLE t1;
|
||||
SET GLOBAL myisam_use_mmap=default;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
@ -109,3 +109,48 @@ SELECT COUNT(*) FROM mysql_db1.t1 WHERE c2 < 5;
|
||||
#
|
||||
DROP TABLE mysql_db1.t1;
|
||||
DROP DATABASE mysql_db1;
|
||||
|
||||
--echo #
|
||||
--echo # BUG#11761180 - 53646: MYISAMPACK CORRUPTS TABLES WITH FULLTEXT INDEXES
|
||||
--echo #
|
||||
CREATE TABLE t1(a CHAR(4), FULLTEXT(a));
|
||||
INSERT INTO t1 VALUES('aaaa'),('bbbb'),('cccc');
|
||||
FLUSH TABLE t1;
|
||||
--exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1
|
||||
--exec $MYISAMCHK -srq $MYSQLD_DATADIR/test/t1
|
||||
CHECK TABLE t1;
|
||||
SELECT * FROM t1 WHERE MATCH(a) AGAINST('aaaa' IN BOOLEAN MODE);
|
||||
SELECT * FROM t1 WHERE MATCH(a) AGAINST('aaaa');
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # Test table with key_reflength > rec_reflength
|
||||
CREATE TABLE t1(a CHAR(30), FULLTEXT(a));
|
||||
--disable_query_log
|
||||
--echo # Populating a table, so it's index file exceeds 65K
|
||||
let $1=1700;
|
||||
while ($1)
|
||||
{
|
||||
eval INSERT INTO t1 VALUES('$1aaaaaaaaaaaaaaaaaaaaaaaaaa');
|
||||
dec $1;
|
||||
}
|
||||
|
||||
--echo # Populating a table, so index file has second level fulltext tree
|
||||
let $1=60;
|
||||
while ($1)
|
||||
{
|
||||
eval INSERT INTO t1 VALUES('aaaa'),('aaaa'),('aaaa'),('aaaa'),('aaaa');
|
||||
dec $1;
|
||||
}
|
||||
--enable_query_log
|
||||
|
||||
FLUSH TABLE t1;
|
||||
--echo # Compressing table
|
||||
--exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1
|
||||
--echo # Fixing index (repair by sort)
|
||||
--exec $MYISAMCHK -srnq $MYSQLD_DATADIR/test/t1
|
||||
CHECK TABLE t1;
|
||||
FLUSH TABLE t1;
|
||||
--echo # Fixing index (repair with keycache)
|
||||
--exec $MYISAMCHK -soq $MYSQLD_DATADIR/test/t1
|
||||
CHECK TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user