From: Marc Alff Date: February 8 2012 3:56pm Subject: bzr push into mysql-trunk-wl5259 branch (marc.alff:3375 to 3377) List-Archive: http://lists.mysql.com/commits/142807 Message-Id: <201202081556.q18FuK4k012290@acsmt357.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3377 Marc Alff 2012-02-08 Renaming due to review comments modified: mysql-test/suite/perfschema/r/hostcache_peer_addr.result mysql-test/suite/perfschema/t/hostcache_peer_addr.test sql/mysqld.cc sql/mysqld.h sql/sql_acl.cc sql/sql_connect.cc 3376 Marc Alff 2012-02-08 [merge] Merge mysql-trunk --> mysql-trunk-wl5259 modified: mysql-test/include/subquery.inc mysql-test/r/innodb_mysql_sync.result mysql-test/r/partition_windows.result mysql-test/r/subquery_all.result mysql-test/r/subquery_all_bka.result mysql-test/r/subquery_all_bka_nixbnl.result mysql-test/r/subquery_nomat_nosj.result mysql-test/r/subquery_nomat_nosj_bka.result mysql-test/r/subquery_nomat_nosj_bka_nixbnl.result mysql-test/r/subquery_none.result mysql-test/r/subquery_none_bka.result mysql-test/r/subquery_none_bka_nixbnl.result mysql-test/t/innodb_mysql_sync.test sql/item.h sql/item_cmpfunc.cc sql/item_cmpfunc.h sql/log_event.cc sql/partition_info.cc sql/sql_executor.cc sql/sql_lex.cc sql/sql_optimizer.cc sql/sql_parse.cc sql/sql_show.cc sql/sql_table.cc storage/archive/ha_archive.cc storage/innobase/handler/ha_innodb.cc storage/myisam/ha_myisam.cc 3375 Marc Alff 2012-02-07 [merge] Merge mysql-trunk --> mysql-trunk-wl5259 added: mysql-test/suite/innodb/r/innodb_bug11754376.result mysql-test/suite/innodb/t/innodb_bug11754376.test unittest/gunit/filesort_compare-t.cc modified: include/my_sys.h mysql-test/include/subquery.inc mysql-test/r/ctype_many.result mysql-test/r/group_by.result mysql-test/r/join_outer.result mysql-test/r/join_outer_bka.result mysql-test/r/join_outer_bka_nixbnl.result mysql-test/r/mix2_myisam.result mysql-test/r/myisam.result mysql-test/r/subquery_all.result mysql-test/r/subquery_all_bka.result mysql-test/r/subquery_all_bka_nixbnl.result mysql-test/r/subquery_nomat_nosj.result mysql-test/r/subquery_nomat_nosj_bka.result mysql-test/r/subquery_nomat_nosj_bka_nixbnl.result mysql-test/r/subquery_none.result mysql-test/r/subquery_none_bka.result mysql-test/r/subquery_none_bka_nixbnl.result mysql-test/r/type_temporal_fractional.result mysql-test/suite/funcs_1/r/innodb_views.result mysql-test/suite/funcs_1/r/memory_views.result mysql-test/suite/funcs_1/views/views_master.inc mysql-test/suite/innodb/r/innodb.result mysql-test/t/join_outer.test mysql-test/valgrind.supp mysys/mf_radix.c mysys/mf_sort.c sql/filesort.cc sql/filesort_utils.cc sql/filesort_utils.h sql/item.h sql/sql_optimizer.cc sql/table.h storage/archive/ha_archive.cc storage/innobase/handler/ha_innodb.cc storage/myisam/mi_dbug.c unittest/gunit/CMakeLists.txt unittest/gunit/dynarray-t.cc === modified file 'mysql-test/include/subquery.inc' --- a/mysql-test/include/subquery.inc 2012-02-07 12:02:00 +0000 +++ b/mysql-test/include/subquery.inc 2012-02-07 14:50:31 +0000 @@ -5730,3 +5730,77 @@ eval $query; DROP TABLE t1; DROP VIEW v1,v2; +--echo # +--echo # Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY +--echo # HAS AN EMPTY RESULT +--echo # + +CREATE TABLE t1 ( + pk int NOT NULL, + col_int_nokey int NOT NULL, + col_int_key int NOT NULL, + col_time_key time NOT NULL, + col_varchar_key varchar(1) NOT NULL, + col_varchar_nokey varchar(1) NOT NULL, + PRIMARY KEY (pk), + KEY col_int_key (col_int_key), + KEY col_time_key (col_time_key), + KEY col_varchar_key (col_varchar_key,col_int_key) +) ENGINE=MyISAM; + +CREATE TABLE t2 ( + pk int NOT NULL AUTO_INCREMENT, + col_int_nokey int NOT NULL, + col_int_key int NOT NULL, + col_time_key time NOT NULL, + col_varchar_key varchar(1) NOT NULL, + col_varchar_nokey varchar(1) NOT NULL, + PRIMARY KEY (pk), + KEY col_int_key (col_int_key), + KEY col_time_key (col_time_key), + KEY col_varchar_key (col_varchar_key,col_int_key) +) ENGINE=MyISAM; + +INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b'); + +SET @var2:=4, @var3:=8; + +--echo +--echo Testcase without inner subquery + +let $subq= +SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR + sq4_alias1.col_varchar_key = @var3; + +eval EXPLAIN $subq; +eval $subq; +SELECT @var3; + +# Now as derived table: +eval EXPLAIN SELECT * FROM ( $subq ) AS alias3; +eval SELECT * FROM ( $subq ) AS alias3; +SELECT @var3; + +--echo +--echo Testcase with inner subquery; crashed WL#6095 +SET @var3=8; +let $subq= +SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) + NOT IN + (SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, + c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 + FROM t2 AS c_sq1_alias1 + WHERE (c_sq1_alias1.col_int_nokey != @var2 + OR c_sq1_alias1.pk != @var3)); + +eval EXPLAIN $subq; +eval $subq; +# Now as derived table: +eval EXPLAIN SELECT * FROM ( $subq ) AS alias3; +eval SELECT * FROM ( $subq ) AS alias3; + +DROP TABLE t1,t2; === modified file 'mysql-test/r/innodb_mysql_sync.result' --- a/mysql-test/r/innodb_mysql_sync.result 2011-06-01 12:24:51 +0000 +++ b/mysql-test/r/innodb_mysql_sync.result 2012-02-08 13:10:23 +0000 @@ -186,3 +186,29 @@ a b 1 12345 2 23456 DROP TABLE t1; +# +# Bug#13417754 ASSERT IN ROW_DROP_DATABASE_FOR_MYSQL DURING DROP SCHEMA +# +DROP TABLE IF EXISTS t1; +DROP DATABASE IF EXISTS db1; +CREATE TABLE t1(a int) engine=InnoDB; +CREATE DATABASE db1; +# Connection con1 +SET DEBUG_SYNC= 'after_innobase_rename_table SIGNAL locked WAIT_FOR continue'; +# Sending: +ALTER TABLE t1 RENAME db1.t1; +# Connection con2 +SET DEBUG_SYNC= 'now WAIT_FOR locked'; +# DROP DATABASE db1 should now be blocked by ALTER TABLE +# Sending: +DROP DATABASE db1; +# Connection default +# Check that DROP DATABASE is blocked by IX lock on db1 +# Resume ALTER TABLE +SET DEBUG_SYNC= 'now SIGNAL continue'; +# Connection con1 +# Reaping: ALTER TABLE t1 RENAME db1.t1; +# Connection con2 +# Reaping: DROP DATABASE db1 +# Connection default; +SET DEBUG_SYNC= 'RESET'; === modified file 'mysql-test/r/partition_windows.result' --- a/mysql-test/r/partition_windows.result 2008-10-26 17:05:24 +0000 +++ b/mysql-test/r/partition_windows.result 2012-02-07 23:33:54 +0000 @@ -26,5 +26,9 @@ ALTER TABLE t1 ADD PARTITION (PARTITION Warnings: Warning 1618 option ignored Warning 1618 option ignored +Warning 1618 option ignored +Warning 1618 option ignored +Warning 1618 option ignored +Warning 1618 option ignored INSERT INTO t1 VALUES (NULL, "last", 4); DROP TABLE t1; === modified file 'mysql-test/r/subquery_all.result' --- a/mysql-test/r/subquery_all.result 2012-02-07 12:02:00 +0000 +++ b/mysql-test/r/subquery_all.result 2012-02-07 14:50:31 +0000 @@ -6970,4 +6970,114 @@ v v DROP TABLE t1; DROP VIEW v1,v2; +# +# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY +# HAS AN EMPTY RESULT +# +CREATE TABLE t1 ( +pk int NOT NULL, +col_int_nokey int NOT NULL, +col_int_key int NOT NULL, +col_time_key time NOT NULL, +col_varchar_key varchar(1) NOT NULL, +col_varchar_nokey varchar(1) NOT NULL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_time_key (col_time_key), +KEY col_varchar_key (col_varchar_key,col_int_key) +) ENGINE=MyISAM; +CREATE TABLE t2 ( +pk int NOT NULL AUTO_INCREMENT, +col_int_nokey int NOT NULL, +col_int_key int NOT NULL, +col_time_key time NOT NULL, +col_varchar_key varchar(1) NOT NULL, +col_varchar_nokey varchar(1) NOT NULL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_time_key (col_time_key), +KEY col_varchar_key (col_varchar_key,col_int_key) +) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b'); +SET @var2:=4, @var3:=8; + +Testcase without inner subquery +EXPLAIN SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3; +@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +SELECT @var3; +@var3 +8 +EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3 ) AS alias3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY 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 +SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3 ) AS alias3; +@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +SELECT @var3; +@var3 +8 + +Testcase with inner subquery; crashed WL#6095 +SET @var3=8; +EXPLAIN SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY,col_varchar_key NULL NULL NULL 1 +SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)); +pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +EXPLAIN SELECT * FROM ( SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)) ) AS alias3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY 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 +3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY,col_varchar_key NULL NULL NULL 1 +SELECT * FROM ( SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)) ) AS alias3; +pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +DROP TABLE t1,t2; set optimizer_switch=default; === modified file 'mysql-test/r/subquery_all_bka.result' --- a/mysql-test/r/subquery_all_bka.result 2012-02-07 12:02:00 +0000 +++ b/mysql-test/r/subquery_all_bka.result 2012-02-07 14:50:31 +0000 @@ -6971,5 +6971,115 @@ v v DROP TABLE t1; DROP VIEW v1,v2; +# +# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY +# HAS AN EMPTY RESULT +# +CREATE TABLE t1 ( +pk int NOT NULL, +col_int_nokey int NOT NULL, +col_int_key int NOT NULL, +col_time_key time NOT NULL, +col_varchar_key varchar(1) NOT NULL, +col_varchar_nokey varchar(1) NOT NULL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_time_key (col_time_key), +KEY col_varchar_key (col_varchar_key,col_int_key) +) ENGINE=MyISAM; +CREATE TABLE t2 ( +pk int NOT NULL AUTO_INCREMENT, +col_int_nokey int NOT NULL, +col_int_key int NOT NULL, +col_time_key time NOT NULL, +col_varchar_key varchar(1) NOT NULL, +col_varchar_nokey varchar(1) NOT NULL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_time_key (col_time_key), +KEY col_varchar_key (col_varchar_key,col_int_key) +) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b'); +SET @var2:=4, @var3:=8; + +Testcase without inner subquery +EXPLAIN SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3; +@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +SELECT @var3; +@var3 +8 +EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3 ) AS alias3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY 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 +SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3 ) AS alias3; +@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +SELECT @var3; +@var3 +8 + +Testcase with inner subquery; crashed WL#6095 +SET @var3=8; +EXPLAIN SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY,col_varchar_key NULL NULL NULL 1 +SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)); +pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +EXPLAIN SELECT * FROM ( SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)) ) AS alias3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY 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 +3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY,col_varchar_key NULL NULL NULL 1 +SELECT * FROM ( SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)) ) AS alias3; +pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +DROP TABLE t1,t2; set optimizer_switch=default; set optimizer_switch=default; === modified file 'mysql-test/r/subquery_all_bka_nixbnl.result' --- a/mysql-test/r/subquery_all_bka_nixbnl.result 2012-02-07 12:02:00 +0000 +++ b/mysql-test/r/subquery_all_bka_nixbnl.result 2012-02-07 14:50:31 +0000 @@ -6971,5 +6971,115 @@ v v DROP TABLE t1; DROP VIEW v1,v2; +# +# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY +# HAS AN EMPTY RESULT +# +CREATE TABLE t1 ( +pk int NOT NULL, +col_int_nokey int NOT NULL, +col_int_key int NOT NULL, +col_time_key time NOT NULL, +col_varchar_key varchar(1) NOT NULL, +col_varchar_nokey varchar(1) NOT NULL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_time_key (col_time_key), +KEY col_varchar_key (col_varchar_key,col_int_key) +) ENGINE=MyISAM; +CREATE TABLE t2 ( +pk int NOT NULL AUTO_INCREMENT, +col_int_nokey int NOT NULL, +col_int_key int NOT NULL, +col_time_key time NOT NULL, +col_varchar_key varchar(1) NOT NULL, +col_varchar_nokey varchar(1) NOT NULL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_time_key (col_time_key), +KEY col_varchar_key (col_varchar_key,col_int_key) +) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b'); +SET @var2:=4, @var3:=8; + +Testcase without inner subquery +EXPLAIN SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3; +@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +SELECT @var3; +@var3 +8 +EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3 ) AS alias3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY 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 +SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3 ) AS alias3; +@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +SELECT @var3; +@var3 +8 + +Testcase with inner subquery; crashed WL#6095 +SET @var3=8; +EXPLAIN SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY,col_varchar_key NULL NULL NULL 1 +SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)); +pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +EXPLAIN SELECT * FROM ( SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)) ) AS alias3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY 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 +3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY,col_varchar_key NULL NULL NULL 1 +SELECT * FROM ( SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)) ) AS alias3; +pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +DROP TABLE t1,t2; set optimizer_switch=default; set optimizer_switch=default; === modified file 'mysql-test/r/subquery_nomat_nosj.result' --- a/mysql-test/r/subquery_nomat_nosj.result 2012-02-07 12:02:00 +0000 +++ b/mysql-test/r/subquery_nomat_nosj.result 2012-02-07 14:50:31 +0000 @@ -6970,4 +6970,114 @@ v v DROP TABLE t1; DROP VIEW v1,v2; +# +# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY +# HAS AN EMPTY RESULT +# +CREATE TABLE t1 ( +pk int NOT NULL, +col_int_nokey int NOT NULL, +col_int_key int NOT NULL, +col_time_key time NOT NULL, +col_varchar_key varchar(1) NOT NULL, +col_varchar_nokey varchar(1) NOT NULL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_time_key (col_time_key), +KEY col_varchar_key (col_varchar_key,col_int_key) +) ENGINE=MyISAM; +CREATE TABLE t2 ( +pk int NOT NULL AUTO_INCREMENT, +col_int_nokey int NOT NULL, +col_int_key int NOT NULL, +col_time_key time NOT NULL, +col_varchar_key varchar(1) NOT NULL, +col_varchar_nokey varchar(1) NOT NULL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_time_key (col_time_key), +KEY col_varchar_key (col_varchar_key,col_int_key) +) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b'); +SET @var2:=4, @var3:=8; + +Testcase without inner subquery +EXPLAIN SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3; +@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +SELECT @var3; +@var3 +8 +EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3 ) AS alias3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY 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 +SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3 ) AS alias3; +@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +SELECT @var3; +@var3 +8 + +Testcase with inner subquery; crashed WL#6095 +SET @var3=8; +EXPLAIN SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY,col_varchar_key NULL NULL NULL 1 +SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)); +pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +EXPLAIN SELECT * FROM ( SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)) ) AS alias3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY 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 +3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY,col_varchar_key NULL NULL NULL 1 +SELECT * FROM ( SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)) ) AS alias3; +pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +DROP TABLE t1,t2; set optimizer_switch=default; === modified file 'mysql-test/r/subquery_nomat_nosj_bka.result' --- a/mysql-test/r/subquery_nomat_nosj_bka.result 2012-02-07 12:02:00 +0000 +++ b/mysql-test/r/subquery_nomat_nosj_bka.result 2012-02-07 14:50:31 +0000 @@ -6971,5 +6971,115 @@ v v DROP TABLE t1; DROP VIEW v1,v2; +# +# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY +# HAS AN EMPTY RESULT +# +CREATE TABLE t1 ( +pk int NOT NULL, +col_int_nokey int NOT NULL, +col_int_key int NOT NULL, +col_time_key time NOT NULL, +col_varchar_key varchar(1) NOT NULL, +col_varchar_nokey varchar(1) NOT NULL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_time_key (col_time_key), +KEY col_varchar_key (col_varchar_key,col_int_key) +) ENGINE=MyISAM; +CREATE TABLE t2 ( +pk int NOT NULL AUTO_INCREMENT, +col_int_nokey int NOT NULL, +col_int_key int NOT NULL, +col_time_key time NOT NULL, +col_varchar_key varchar(1) NOT NULL, +col_varchar_nokey varchar(1) NOT NULL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_time_key (col_time_key), +KEY col_varchar_key (col_varchar_key,col_int_key) +) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b'); +SET @var2:=4, @var3:=8; + +Testcase without inner subquery +EXPLAIN SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3; +@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +SELECT @var3; +@var3 +8 +EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3 ) AS alias3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY 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 +SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3 ) AS alias3; +@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +SELECT @var3; +@var3 +8 + +Testcase with inner subquery; crashed WL#6095 +SET @var3=8; +EXPLAIN SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY,col_varchar_key NULL NULL NULL 1 +SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)); +pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +EXPLAIN SELECT * FROM ( SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)) ) AS alias3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY 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 +3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY,col_varchar_key NULL NULL NULL 1 +SELECT * FROM ( SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)) ) AS alias3; +pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +DROP TABLE t1,t2; set optimizer_switch=default; set optimizer_switch=default; === modified file 'mysql-test/r/subquery_nomat_nosj_bka_nixbnl.result' --- a/mysql-test/r/subquery_nomat_nosj_bka_nixbnl.result 2012-02-07 12:02:00 +0000 +++ b/mysql-test/r/subquery_nomat_nosj_bka_nixbnl.result 2012-02-07 14:50:31 +0000 @@ -6971,5 +6971,115 @@ v v DROP TABLE t1; DROP VIEW v1,v2; +# +# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY +# HAS AN EMPTY RESULT +# +CREATE TABLE t1 ( +pk int NOT NULL, +col_int_nokey int NOT NULL, +col_int_key int NOT NULL, +col_time_key time NOT NULL, +col_varchar_key varchar(1) NOT NULL, +col_varchar_nokey varchar(1) NOT NULL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_time_key (col_time_key), +KEY col_varchar_key (col_varchar_key,col_int_key) +) ENGINE=MyISAM; +CREATE TABLE t2 ( +pk int NOT NULL AUTO_INCREMENT, +col_int_nokey int NOT NULL, +col_int_key int NOT NULL, +col_time_key time NOT NULL, +col_varchar_key varchar(1) NOT NULL, +col_varchar_nokey varchar(1) NOT NULL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_time_key (col_time_key), +KEY col_varchar_key (col_varchar_key,col_int_key) +) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b'); +SET @var2:=4, @var3:=8; + +Testcase without inner subquery +EXPLAIN SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3; +@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +SELECT @var3; +@var3 +8 +EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3 ) AS alias3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY 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 +SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3 ) AS alias3; +@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +SELECT @var3; +@var3 +8 + +Testcase with inner subquery; crashed WL#6095 +SET @var3=8; +EXPLAIN SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY,col_varchar_key NULL NULL NULL 1 +SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)); +pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +EXPLAIN SELECT * FROM ( SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)) ) AS alias3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY 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 +3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY,col_varchar_key NULL NULL NULL 1 +SELECT * FROM ( SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)) ) AS alias3; +pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +DROP TABLE t1,t2; set optimizer_switch=default; set optimizer_switch=default; === modified file 'mysql-test/r/subquery_none.result' --- a/mysql-test/r/subquery_none.result 2012-02-07 12:02:00 +0000 +++ b/mysql-test/r/subquery_none.result 2012-02-07 14:50:31 +0000 @@ -6969,4 +6969,114 @@ v v DROP TABLE t1; DROP VIEW v1,v2; +# +# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY +# HAS AN EMPTY RESULT +# +CREATE TABLE t1 ( +pk int NOT NULL, +col_int_nokey int NOT NULL, +col_int_key int NOT NULL, +col_time_key time NOT NULL, +col_varchar_key varchar(1) NOT NULL, +col_varchar_nokey varchar(1) NOT NULL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_time_key (col_time_key), +KEY col_varchar_key (col_varchar_key,col_int_key) +) ENGINE=MyISAM; +CREATE TABLE t2 ( +pk int NOT NULL AUTO_INCREMENT, +col_int_nokey int NOT NULL, +col_int_key int NOT NULL, +col_time_key time NOT NULL, +col_varchar_key varchar(1) NOT NULL, +col_varchar_nokey varchar(1) NOT NULL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_time_key (col_time_key), +KEY col_varchar_key (col_varchar_key,col_int_key) +) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b'); +SET @var2:=4, @var3:=8; + +Testcase without inner subquery +EXPLAIN SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3; +@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +SELECT @var3; +@var3 +8 +EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3 ) AS alias3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY 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 +SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3 ) AS alias3; +@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +SELECT @var3; +@var3 +8 + +Testcase with inner subquery; crashed WL#6095 +SET @var3=8; +EXPLAIN SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY,col_varchar_key NULL NULL NULL 1 +SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)); +pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +EXPLAIN SELECT * FROM ( SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)) ) AS alias3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY 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 +3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY,col_varchar_key NULL NULL NULL 1 +SELECT * FROM ( SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)) ) AS alias3; +pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +DROP TABLE t1,t2; set optimizer_switch=default; === modified file 'mysql-test/r/subquery_none_bka.result' --- a/mysql-test/r/subquery_none_bka.result 2012-02-07 12:02:00 +0000 +++ b/mysql-test/r/subquery_none_bka.result 2012-02-07 14:50:31 +0000 @@ -6970,5 +6970,115 @@ v v DROP TABLE t1; DROP VIEW v1,v2; +# +# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY +# HAS AN EMPTY RESULT +# +CREATE TABLE t1 ( +pk int NOT NULL, +col_int_nokey int NOT NULL, +col_int_key int NOT NULL, +col_time_key time NOT NULL, +col_varchar_key varchar(1) NOT NULL, +col_varchar_nokey varchar(1) NOT NULL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_time_key (col_time_key), +KEY col_varchar_key (col_varchar_key,col_int_key) +) ENGINE=MyISAM; +CREATE TABLE t2 ( +pk int NOT NULL AUTO_INCREMENT, +col_int_nokey int NOT NULL, +col_int_key int NOT NULL, +col_time_key time NOT NULL, +col_varchar_key varchar(1) NOT NULL, +col_varchar_nokey varchar(1) NOT NULL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_time_key (col_time_key), +KEY col_varchar_key (col_varchar_key,col_int_key) +) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b'); +SET @var2:=4, @var3:=8; + +Testcase without inner subquery +EXPLAIN SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3; +@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +SELECT @var3; +@var3 +8 +EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3 ) AS alias3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY 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 +SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3 ) AS alias3; +@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +SELECT @var3; +@var3 +8 + +Testcase with inner subquery; crashed WL#6095 +SET @var3=8; +EXPLAIN SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY,col_varchar_key NULL NULL NULL 1 +SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)); +pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +EXPLAIN SELECT * FROM ( SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)) ) AS alias3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY 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 +3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY,col_varchar_key NULL NULL NULL 1 +SELECT * FROM ( SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)) ) AS alias3; +pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +DROP TABLE t1,t2; set optimizer_switch=default; set optimizer_switch=default; === modified file 'mysql-test/r/subquery_none_bka_nixbnl.result' --- a/mysql-test/r/subquery_none_bka_nixbnl.result 2012-02-07 12:02:00 +0000 +++ b/mysql-test/r/subquery_none_bka_nixbnl.result 2012-02-07 14:50:31 +0000 @@ -6970,5 +6970,115 @@ v v DROP TABLE t1; DROP VIEW v1,v2; +# +# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY +# HAS AN EMPTY RESULT +# +CREATE TABLE t1 ( +pk int NOT NULL, +col_int_nokey int NOT NULL, +col_int_key int NOT NULL, +col_time_key time NOT NULL, +col_varchar_key varchar(1) NOT NULL, +col_varchar_nokey varchar(1) NOT NULL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_time_key (col_time_key), +KEY col_varchar_key (col_varchar_key,col_int_key) +) ENGINE=MyISAM; +CREATE TABLE t2 ( +pk int NOT NULL AUTO_INCREMENT, +col_int_nokey int NOT NULL, +col_int_key int NOT NULL, +col_time_key time NOT NULL, +col_varchar_key varchar(1) NOT NULL, +col_varchar_nokey varchar(1) NOT NULL, +PRIMARY KEY (pk), +KEY col_int_key (col_int_key), +KEY col_time_key (col_time_key), +KEY col_varchar_key (col_varchar_key,col_int_key) +) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b'); +SET @var2:=4, @var3:=8; + +Testcase without inner subquery +EXPLAIN SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3; +@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +SELECT @var3; +@var3 +8 +EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3 ) AS alias3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY 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 +SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR +sq4_alias1.col_varchar_key = @var3 ) AS alias3; +@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +SELECT @var3; +@var3 +8 + +Testcase with inner subquery; crashed WL#6095 +SET @var3=8; +EXPLAIN SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY,col_varchar_key NULL NULL NULL 1 +SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)); +pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +EXPLAIN SELECT * FROM ( SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)) ) AS alias3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY 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 +3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY,col_varchar_key NULL NULL NULL 1 +SELECT * FROM ( SELECT sq4_alias1.* +FROM t1 AS sq4_alias1 +WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) +NOT IN +(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1, +c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 +FROM t2 AS c_sq1_alias1 +WHERE (c_sq1_alias1.col_int_nokey != @var2 +OR c_sq1_alias1.pk != @var3)) ) AS alias3; +pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey +DROP TABLE t1,t2; set optimizer_switch=default; set optimizer_switch=default; === modified file 'mysql-test/suite/perfschema/r/hostcache_peer_addr.result' --- a/mysql-test/suite/perfschema/r/hostcache_peer_addr.result 2012-02-06 09:49:52 +0000 +++ b/mysql-test/suite/perfschema/r/hostcache_peer_addr.result 2012-02-08 15:55:31 +0000 @@ -3,14 +3,14 @@ flush hosts; select @@global.debug; @@global.debug -show global status like "connection_%_errors"; +show global status like "connection_errors_%"; Variable_name Value -Connection_accept_errors 0 -Connection_internal_errors 0 -Connection_max_connection_errors 0 -Connection_peer_address_errors 0 -Connection_select_errors 0 -Connection_tcpwrap_errors 0 +Connection_errors_accept 0 +Connection_errors_internal 0 +Connection_errors_max_connection 0 +Connection_errors_peer_address 0 +Connection_errors_select 0 +Connection_errors_tcpwrap 0 select "Con1 is alive"; Con1 is alive Con1 is alive @@ -19,14 +19,14 @@ current_user() root@localhost set global debug= "+d,vio_peer_addr_error"; ERROR HY000: Can't get hostname for your address -show global status like "connection_%_errors"; +show global status like "connection_errors_%"; Variable_name Value -Connection_accept_errors 0 -Connection_internal_errors 0 -Connection_max_connection_errors 0 -Connection_peer_address_errors 1 -Connection_select_errors 0 -Connection_tcpwrap_errors 0 +Connection_errors_accept 0 +Connection_errors_internal 0 +Connection_errors_max_connection 0 +Connection_errors_peer_address 1 +Connection_errors_select 0 +Connection_errors_tcpwrap 0 select IP, HOST, HOST_VALIDATED, SUM_CONNECT_ERRORS, COUNT_HOST_BLOCKED_ERRORS, @@ -54,14 +54,14 @@ if (FIRST_ERROR_SEEN is not null, "set", if (LAST_ERROR_SEEN is not null, "set", "null") as LAST_ERROR_SEEN from performance_schema.host_cache; ERROR HY000: Can't get hostname for your address -show global status like "connection_%_errors"; +show global status like "connection_errors_%"; Variable_name Value -Connection_accept_errors 0 -Connection_internal_errors 0 -Connection_max_connection_errors 0 -Connection_peer_address_errors 2 -Connection_select_errors 0 -Connection_tcpwrap_errors 0 +Connection_errors_accept 0 +Connection_errors_internal 0 +Connection_errors_max_connection 0 +Connection_errors_peer_address 2 +Connection_errors_select 0 +Connection_errors_tcpwrap 0 select IP, HOST, HOST_VALIDATED, SUM_CONNECT_ERRORS, COUNT_HOST_BLOCKED_ERRORS, @@ -90,11 +90,11 @@ if (LAST_ERROR_SEEN is not null, "set", from performance_schema.host_cache; set global debug= default; flush status; -show global status like "connection_%_errors"; +show global status like "connection_errors_%"; Variable_name Value -Connection_accept_errors 0 -Connection_internal_errors 0 -Connection_max_connection_errors 0 -Connection_peer_address_errors 0 -Connection_select_errors 0 -Connection_tcpwrap_errors 0 +Connection_errors_accept 0 +Connection_errors_internal 0 +Connection_errors_max_connection 0 +Connection_errors_peer_address 0 +Connection_errors_select 0 +Connection_errors_tcpwrap 0 === modified file 'mysql-test/suite/perfschema/t/hostcache_peer_addr.test' --- a/mysql-test/suite/perfschema/t/hostcache_peer_addr.test 2012-02-01 17:24:09 +0000 +++ b/mysql-test/suite/perfschema/t/hostcache_peer_addr.test 2012-02-08 15:55:31 +0000 @@ -12,7 +12,7 @@ flush status; flush hosts; select @@global.debug; -show global status like "connection_%_errors"; +show global status like "connection_errors_%"; connect (con1,"127.0.0.1",root,,test,$MASTER_MYPORT,); select "Con1 is alive"; @@ -28,7 +28,7 @@ connect (con2,"127.0.0.1",root,,test,$MA --enable_query_log --connection default -show global status like "connection_%_errors"; +show global status like "connection_errors_%"; --source ../include/hostcache_dump.inc --disable_query_log @@ -37,11 +37,11 @@ connect (con3,"127.0.0.1",root,,test,$MA --enable_query_log --connection default -show global status like "connection_%_errors"; +show global status like "connection_errors_%"; --source ../include/hostcache_dump.inc set global debug= default; flush status; -show global status like "connection_%_errors"; +show global status like "connection_errors_%"; === modified file 'mysql-test/t/innodb_mysql_sync.test' --- a/mysql-test/t/innodb_mysql_sync.test 2011-06-01 12:24:51 +0000 +++ b/mysql-test/t/innodb_mysql_sync.test 2012-02-08 13:10:23 +0000 @@ -304,6 +304,62 @@ DROP TABLE t1; disconnect con1; +--echo # +--echo # Bug#13417754 ASSERT IN ROW_DROP_DATABASE_FOR_MYSQL DURING DROP SCHEMA +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP DATABASE IF EXISTS db1; +--enable_warnings + +CREATE TABLE t1(a int) engine=InnoDB; +CREATE DATABASE db1; + +connect(con1, localhost, root); +connect(con2, localhost, root); + +--echo # Connection con1 +connection con1; +SET DEBUG_SYNC= 'after_innobase_rename_table SIGNAL locked WAIT_FOR continue'; +--echo # Sending: +--send ALTER TABLE t1 RENAME db1.t1 + +--echo # Connection con2 +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR locked'; +--echo # DROP DATABASE db1 should now be blocked by ALTER TABLE +--echo # Sending: +--send DROP DATABASE db1 + +--echo # Connection default +connection default; +--echo # Check that DROP DATABASE is blocked by IX lock on db1 +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE state = "Waiting for schema metadata lock" and + info = "DROP DATABASE db1"; +--source include/wait_condition.inc +--echo # Resume ALTER TABLE +SET DEBUG_SYNC= 'now SIGNAL continue'; + +--echo # Connection con1 +connection con1; +--echo # Reaping: ALTER TABLE t1 RENAME db1.t1; +--reap + +--echo # Connection con2 +connection con2; +--echo # Reaping: DROP DATABASE db1 +--reap + +--echo # Connection default; +connection default; +SET DEBUG_SYNC= 'RESET'; +disconnect con1; +disconnect con2; + + # Check that all connections opened by test cases in this file are really # gone so execution of other tests won't be affected by their presence. --source include/wait_until_count_sessions.inc === modified file 'sql/item.h' --- a/sql/item.h 2012-02-07 10:30:39 +0000 +++ b/sql/item.h 2012-02-08 10:33:37 +0000 @@ -1045,6 +1045,8 @@ public: /* Returns true if this is constant (during query execution, i.e. its value will not change until next fix_fields) and its value is known. + When the default implementation of used_tables() is effective, this + function will always return true (because used_tables() is empty). */ virtual bool const_item() const { return used_tables() == 0; } /* @@ -1548,10 +1550,7 @@ public: bool is_null(); public: - inline void make_field(Send_field *field); - - inline bool const_item() const; - + inline void make_field(Send_field *field); inline int save_in_field(Field *field, bool no_conversions); inline bool send(Protocol *protocol, String *str); }; @@ -1571,11 +1570,6 @@ inline void Item_sp_variable::make_field it->make_field(field); } -inline bool Item_sp_variable::const_item() const -{ - return TRUE; -} - inline int Item_sp_variable::save_in_field(Field *field, bool no_conversions) { return this_item()->save_in_field(field, no_conversions); @@ -1767,11 +1761,6 @@ public: return value_item->result_type(); } - bool const_item() const - { - return TRUE; - } - int save_in_field(Field *field, bool no_conversions) { return value_item->save_in_field(field, no_conversions); === modified file 'sql/item_cmpfunc.cc' --- a/sql/item_cmpfunc.cc 2012-01-25 09:57:22 +0000 +++ b/sql/item_cmpfunc.cc 2012-02-08 10:33:37 +0000 @@ -4722,8 +4722,7 @@ longlong Item_func_bit_and::val_int() Item_cond::Item_cond(THD *thd, Item_cond *item) :Item_bool_func(thd, item), - abort_on_null(item->abort_on_null), - and_tables_cache(item->and_tables_cache) + abort_on_null(item->abort_on_null) { /* item->list will be copied by copy_andor_arguments() call @@ -4748,16 +4747,16 @@ Item_cond::fix_fields(THD *thd, Item **r st_select_lex::Resolve_place save_resolve= thd->lex->current_select->resolve_place; uchar buff[sizeof(char*)]; // Max local vars in function - not_null_tables_cache= used_tables_cache= 0; - const_item_cache= 1; + used_tables_cache= 0; + const_item_cache= true; if (functype() != COND_AND_FUNC) thd->lex->current_select->resolve_place= st_select_lex::RESOLVE_NONE; - /* - and_table_cache is the value that Item_cond_or() returns for - not_null_tables() - */ - and_tables_cache= ~(table_map) 0; + + if (functype() == COND_AND_FUNC && abort_on_null) + not_null_tables_cache= 0; + else + not_null_tables_cache= ~(table_map) 0; if (check_stack_overrun(thd, STACK_MIN_SIZE, buff)) return TRUE; // Fatal error flag is set! @@ -4778,7 +4777,6 @@ Item_cond::fix_fields(THD *thd, Item **r */ while ((item=li++)) { - table_map tmp_table_map; while (item->type() == Item::COND_ITEM && ((Item_cond*) item)->functype() == functype() && !((Item_cond*) item)->list.is_empty()) @@ -4795,26 +4793,26 @@ Item_cond::fix_fields(THD *thd, Item **r item->fix_fields(thd, li.ref())) || (item= *li.ref())->check_cols(1)) return TRUE; /* purecov: inspected */ - used_tables_cache|= item->used_tables(); - if (item->const_item()) - and_tables_cache= (table_map) 0; + used_tables_cache|= item->used_tables(); + const_item_cache&= item->const_item(); + + // Old code assumed that not_null_tables() was 0 when const_item() was true + DBUG_ASSERT(!item->const_item() || !item->not_null_tables()); + + if (functype() == COND_AND_FUNC && abort_on_null) + not_null_tables_cache|= item->not_null_tables(); else - { - tmp_table_map= item->not_null_tables(); - not_null_tables_cache|= tmp_table_map; - and_tables_cache&= tmp_table_map; - const_item_cache= FALSE; - } - with_sum_func= with_sum_func || item->with_sum_func; - with_subselect|= item->has_subquery(); + not_null_tables_cache&= item->not_null_tables(); + with_sum_func|= item->with_sum_func; + with_subselect|= item->has_subquery(); if (item->maybe_null) - maybe_null=1; + maybe_null= true; } thd->lex->current_select->cond_count+= list.elements; thd->lex->current_select->resolve_place= save_resolve; fix_length_and_dec(); - fixed= 1; - return FALSE; + fixed= true; + return false; } @@ -4825,29 +4823,24 @@ void Item_cond::fix_after_pullout(st_sel List_iterator li(list); Item *item; - used_tables_cache=0; - const_item_cache=1; + used_tables_cache= 0; + const_item_cache= true; - and_tables_cache= ~(table_map) 0; // Here and below we do as fix_fields does - not_null_tables_cache= 0; + if (functype() == COND_AND_FUNC && abort_on_null) + not_null_tables_cache= 0; + else + not_null_tables_cache= ~(table_map) 0; while ((item=li++)) { - table_map tmp_table_map; item->fix_after_pullout(parent_select, removed_select, li.ref()); item= *li.ref(); used_tables_cache|= item->used_tables(); const_item_cache&= item->const_item(); - - if (item->const_item()) - and_tables_cache= (table_map) 0; + if (functype() == COND_AND_FUNC && abort_on_null) + not_null_tables_cache|= item->not_null_tables(); else - { - tmp_table_map= item->not_null_tables(); - not_null_tables_cache|= tmp_table_map; - and_tables_cache&= tmp_table_map; - const_item_cache= FALSE; - } + not_null_tables_cache&= item->not_null_tables(); } } @@ -5003,13 +4996,6 @@ void Item_cond::split_sum_func(THD *thd, } -table_map -Item_cond::used_tables() const -{ // This caches used_tables - return used_tables_cache; -} - - void Item_cond::update_used_tables() { List_iterator_fast li(list); === modified file 'sql/item_cmpfunc.h' --- a/sql/item_cmpfunc.h 2012-01-30 06:39:02 +0000 +++ b/sql/item_cmpfunc.h 2012-02-08 10:33:37 +0000 @@ -1596,7 +1596,6 @@ class Item_cond :public Item_bool_func protected: List list; bool abort_on_null; - table_map and_tables_cache; public: /* Item_cond() is only used to create top level items */ @@ -1632,7 +1631,7 @@ public: enum Type type() const { return COND_ITEM; } List* argument_list() { return &list; } - table_map used_tables() const; + table_map used_tables() const { return used_tables_cache; } void update_used_tables(); virtual void print(String *str, enum_query_type query_type); void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array, @@ -1821,8 +1820,6 @@ public: enum Functype functype() const { return COND_AND_FUNC; } longlong val_int(); const char *func_name() const { return "and"; } - table_map not_null_tables() const - { return abort_on_null ? not_null_tables_cache: and_tables_cache; } Item* copy_andor_structure(THD *thd) { Item_cond_and *item; @@ -1852,7 +1849,6 @@ public: enum Functype functype() const { return COND_OR_FUNC; } longlong val_int(); const char *func_name() const { return "or"; } - table_map not_null_tables() const { return and_tables_cache; } Item* copy_andor_structure(THD *thd) { Item_cond_or *item; === modified file 'sql/log_event.cc' --- a/sql/log_event.cc 2012-01-31 15:16:16 +0000 +++ b/sql/log_event.cc 2012-02-07 23:33:54 +0000 @@ -4316,11 +4316,11 @@ int Query_log_event::do_apply_event(Rela nothing to do. */ /* - We do not replicate IGNORE_DIR_IN_CREATE. That is, if the master is a - slave which runs with SQL_MODE=IGNORE_DIR_IN_CREATE, this should not + We do not replicate MODE_NO_DIR_IN_CREATE. That is, if the master is a + slave which runs with SQL_MODE=MODE_NO_DIR_IN_CREATE, this should not force us to ignore the dir too. Imagine you are a ring of machines, and one has a disk problem so that you temporarily need - IGNORE_DIR_IN_CREATE on this machine; you don't want it to propagate + MODE_NO_DIR_IN_CREATE on this machine; you don't want it to propagate elsewhere (you don't want all slaves to start ignoring the dirs). */ if (sql_mode_inited) === modified file 'sql/mysqld.cc' --- a/sql/mysqld.cc 2012-02-06 09:13:43 +0000 +++ b/sql/mysqld.cc 2012-02-08 15:55:31 +0000 @@ -603,17 +603,17 @@ const char *in_having_cond= " my_decimal decimal_zero; /** Number of connection errors when selecting on the listening port */ -ulong connection_select_errors= 0; +ulong connection_errors_select= 0; /** Number of connection errors when accepting sockets in the listening port. */ -ulong connection_accept_errors= 0; +ulong connection_errors_accept= 0; /** Number of connection errors from TCP wrappers. */ -ulong connection_tcpwrap_errors= 0; +ulong connection_errors_tcpwrap= 0; /** Number of connection errors from internal server errors. */ -ulong connection_internal_errors= 0; +ulong connection_errors_internal= 0; /** Number of connection errors from the server max_connection limit. */ -ulong connection_max_connection_errors= 0; +ulong connection_errors_max_connection= 0; /** Number of errors when reading the peer address. */ -ulong connection_peer_addr_errors= 0; +ulong connection_errors_peer_addr= 0; /* classes for comparation parsing/processing */ Eq_creator eq_creator; @@ -3227,12 +3227,12 @@ int init_common_variables() { char buff[FN_REFLEN]; umask(((~my_umask) & 0666)); - connection_select_errors= 0; - connection_accept_errors= 0; - connection_tcpwrap_errors= 0; - connection_internal_errors= 0; - connection_max_connection_errors= 0; - connection_peer_addr_errors= 0; + connection_errors_select= 0; + connection_errors_accept= 0; + connection_errors_tcpwrap= 0; + connection_errors_internal= 0; + connection_errors_max_connection= 0; + connection_errors_peer_addr= 0; my_decimal_set_zero(&decimal_zero); // set decimal_zero constant; tzset(); // Set tzname @@ -5406,7 +5406,7 @@ void create_thread_to_handle_connection( mysql_mutex_unlock(&LOCK_connection_count); statistic_increment(aborted_connects,&LOCK_status); - statistic_increment(connection_internal_errors, &LOCK_status); + statistic_increment(connection_errors_internal, &LOCK_status); /* Can't use my_error() since store_globals has not been called. */ my_snprintf(error_message_buff, sizeof(error_message_buff), ER_THD(thd, ER_CANT_CREATE_THREAD), error); @@ -5455,7 +5455,7 @@ static void create_new_thread(THD *thd) DBUG_PRINT("error",("Too many connections")); close_connection(thd, ER_CON_COUNT_ERROR); delete thd; - statistic_increment(connection_max_connection_errors, &LOCK_status); + statistic_increment(connection_errors_max_connection, &LOCK_status); DBUG_VOID_RETURN; } @@ -5585,7 +5585,7 @@ void handle_connections_sockets() There is not much details to report about the client, increment the server global status variable. */ - statistic_increment(connection_select_errors, &LOCK_status); + statistic_increment(connection_errors_select, &LOCK_status); if (!select_errors++ && !abort_loop) /* purecov: inspected */ sql_print_error("mysqld: Got error %d from select",socket_errno); /* purecov: inspected */ } @@ -5667,7 +5667,7 @@ void handle_connections_sockets() There is not much details to report about the client, increment the server global status variable. */ - statistic_increment(connection_accept_errors, &LOCK_status); + statistic_increment(connection_errors_accept, &LOCK_status); if ((error_count++ & 255) == 0) // This can happen often sql_perror("Error in accept"); MAYBE_BROKEN_SYSCALL; @@ -5725,7 +5725,7 @@ void handle_connections_sockets() { (void) mysql_socket_shutdown(new_sock, SHUT_RDWR); (void) mysql_socket_close(new_sock); - statistic_increment(connection_internal_errors, &LOCK_status); + statistic_increment(connection_errors_internal, &LOCK_status); continue; } @@ -5750,7 +5750,7 @@ void handle_connections_sockets() (void) mysql_socket_close(new_sock); } delete thd; - statistic_increment(connection_internal_errors, &LOCK_status); + statistic_increment(connection_errors_internal, &LOCK_status); continue; } init_net_server_extension(thd); @@ -7030,12 +7030,12 @@ SHOW_VAR status_vars[]= { {"Com", (char*) com_status_vars, SHOW_ARRAY}, {"Compression", (char*) &show_net_compression, SHOW_FUNC}, {"Connections", (char*) &thread_id, SHOW_LONG_NOFLUSH}, - {"Connection_accept_errors", (char*) &connection_accept_errors, SHOW_LONG}, - {"Connection_internal_errors", (char*) &connection_internal_errors, SHOW_LONG}, - {"Connection_max_connection_errors", (char*) &connection_max_connection_errors, SHOW_LONG}, - {"Connection_peer_address_errors", (char*) &connection_peer_addr_errors, SHOW_LONG}, - {"Connection_select_errors", (char*) &connection_select_errors, SHOW_LONG}, - {"Connection_tcpwrap_errors", (char*) &connection_tcpwrap_errors, SHOW_LONG}, + {"Connection_errors_accept", (char*) &connection_errors_accept, SHOW_LONG}, + {"Connection_errors_internal", (char*) &connection_errors_internal, SHOW_LONG}, + {"Connection_errors_max_connection", (char*) &connection_errors_max_connection, SHOW_LONG}, + {"Connection_errors_peer_address", (char*) &connection_errors_peer_addr, SHOW_LONG}, + {"Connection_errors_select", (char*) &connection_errors_select, SHOW_LONG}, + {"Connection_errors_tcpwrap", (char*) &connection_errors_tcpwrap, SHOW_LONG}, {"Created_tmp_disk_tables", (char*) offsetof(STATUS_VAR, created_tmp_disk_tables), SHOW_LONGLONG_STATUS}, {"Created_tmp_files", (char*) &my_tmp_file_created, SHOW_LONG}, {"Created_tmp_tables", (char*) offsetof(STATUS_VAR, created_tmp_tables), SHOW_LONGLONG_STATUS}, === modified file 'sql/mysqld.h' --- a/sql/mysqld.h 2012-02-01 17:24:09 +0000 +++ b/sql/mysqld.h 2012-02-08 15:55:31 +0000 @@ -237,12 +237,12 @@ extern I_List threads; extern char err_shared_dir[]; extern TYPELIB thread_handling_typelib; extern my_decimal decimal_zero; -extern ulong connection_select_errors; -extern ulong connection_accept_errors; -extern ulong connection_tcpwrap_errors; -extern ulong connection_internal_errors; -extern ulong connection_max_connection_errors; -extern ulong connection_peer_addr_errors; +extern ulong connection_errors_select; +extern ulong connection_errors_accept; +extern ulong connection_errors_tcpwrap; +extern ulong connection_errors_internal; +extern ulong connection_errors_max_connection; +extern ulong connection_errors_peer_addr; extern ulong log_warnings; /* === modified file 'sql/partition_info.cc' --- a/sql/partition_info.cc 2011-12-19 12:53:11 +0000 +++ b/sql/partition_info.cc 2012-02-07 23:33:54 +0000 @@ -1233,9 +1233,7 @@ end: */ static void warn_if_dir_in_part_elem(THD *thd, partition_element *part_elem) { -#ifdef HAVE_READLINK - if (!my_use_symdir || (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE)) -#endif + if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) { if (part_elem->data_file_name) push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, === modified file 'sql/sql_acl.cc' --- a/sql/sql_acl.cc 2012-02-07 14:35:13 +0000 +++ b/sql/sql_acl.cc 2012-02-08 15:55:31 +0000 @@ -9653,7 +9653,7 @@ acl_authenticate(THD *thd, uint com_chan mysql_mutex_unlock(&LOCK_connection_count); if (!count_ok) { // too many connections - statistic_increment(connection_max_connection_errors, &LOCK_status); + statistic_increment(connection_errors_max_connection, &LOCK_status); my_error(ER_CON_COUNT_ERROR, MYF(0)); DBUG_RETURN(1); } === modified file 'sql/sql_connect.cc' --- a/sql/sql_connect.cc 2012-02-06 09:13:43 +0000 +++ b/sql/sql_connect.cc 2012-02-08 15:55:31 +0000 @@ -444,7 +444,7 @@ bool init_new_connection_handler_thread( pthread_detach_this_thread(); if (my_thread_init()) { - statistic_increment(connection_internal_errors, &LOCK_status); + statistic_increment(connection_errors_internal, &LOCK_status); return 1; } return 0; @@ -549,9 +549,9 @@ static int check_connection(THD *thd) /* Since we can not even get the peer IP address, there is nothing to show in the host_cache, - so increment the global status variable "peer_address_errors". + so increment the global status variable for peer address errors. */ - statistic_increment(connection_peer_addr_errors, &LOCK_status); + statistic_increment(connection_errors_peer_addr, &LOCK_status); my_error(ER_BAD_HOST_ERROR, MYF(0)); return 1; } @@ -562,7 +562,7 @@ static int check_connection(THD *thd) this is treated as a global server OOM error. TODO: remove the need for my_strdup. */ - statistic_increment(connection_internal_errors, &LOCK_status); + statistic_increment(connection_errors_internal, &LOCK_status); return 1; /* The error is set by my_strdup(). */ } thd->main_security_ctx.host_or_ip= thd->main_security_ctx.ip; @@ -627,7 +627,7 @@ static int check_connection(THD *thd) Hence, there is no reason to account on OOM conditions per client IP, we count failures in the global server status instead. */ - statistic_increment(connection_internal_errors, &LOCK_status); + statistic_increment(connection_errors_internal, &LOCK_status); return 1; /* The error is set by alloc(). */ } === modified file 'sql/sql_executor.cc' --- a/sql/sql_executor.cc 2012-01-31 11:19:25 +0000 +++ b/sql/sql_executor.cc 2012-02-07 14:50:31 +0000 @@ -2564,9 +2564,9 @@ test_if_quick_select(JOIN_TAB *tab) Reads content of constant table @param tab table @param pos position of table in query plan - @retval 0 ok - @retval >0 error - @retval <0 ?? + @retval 0 ok, one row was found or one NULL-complemented row was created + @retval -1 ok, no row was found and no NULL-complemented row was created + @retval 1 error */ int @@ -2687,6 +2687,16 @@ join_read_const_table(JOIN_TAB *tab, POS } +/** + Read a constant table when there is at most one matching row, using a table + scan. + + @param tab Table to read + + @retval 0 Row was found + @retval -1 Row was not found + @retval 1 Got an error (other than row not found) during read +*/ static int join_read_system(JOIN_TAB *tab) { @@ -2713,16 +2723,14 @@ join_read_system(JOIN_TAB *tab) /** - Read a [constant] table when there is at most one matching row. + Read a constant table when there is at most one matching row, using an + index lookup. @param tab Table to read - @retval - 0 Row was found - @retval - -1 Row was not found - @retval - 1 Got an error (other than row not found) during read + @retval 0 Row was found + @retval -1 Row was not found + @retval 1 Got an error (other than row not found) during read */ static int === modified file 'sql/sql_lex.cc' --- a/sql/sql_lex.cc 2012-01-20 14:44:16 +0000 +++ b/sql/sql_lex.cc 2012-02-08 09:44:42 +0000 @@ -2494,6 +2494,7 @@ void TABLE_LIST::print(THD *thd, String append_identifier(thd, str, table_name, table_name_length); cmp_name= table_name; } +#ifdef WITH_PARTITION_STORAGE_ENGINE if (partition_names && partition_names->elements) { int i, num_parts= partition_names->elements; @@ -2508,6 +2509,7 @@ void TABLE_LIST::print(THD *thd, String } str->append(')'); } +#endif /* WITH_PARTITION_STORAGE_ENGINE */ } if (my_strcasecmp(table_alias_charset, cmp_name, alias)) { === modified file 'sql/sql_optimizer.cc' --- a/sql/sql_optimizer.cc 2012-02-06 12:47:30 +0000 +++ b/sql/sql_optimizer.cc 2012-02-07 20:32:47 +0000 @@ -377,11 +377,9 @@ JOIN::optimize() } if (const_table_map != found_const_table_map && - !(select_options & SELECT_DESCRIBE) && - (!conds || - !(conds->used_tables() & RAND_TABLE_BIT) || - select_lex->master_unit() == &thd->lex->unit)) // upper level SELECT + !(select_options & SELECT_DESCRIBE)) { + // There is at least one empty const table zero_result_cause= "no matching row in const table"; DBUG_PRINT("error",("Error: %s", zero_result_cause)); goto setup_subq_exit; === modified file 'sql/sql_parse.cc' --- a/sql/sql_parse.cc 2012-02-01 18:26:21 +0000 +++ b/sql/sql_parse.cc 2012-02-08 14:27:40 +0000 @@ -2603,14 +2603,13 @@ case SQLCOM_PREPARE: /* Might have been updated in create_table_precheck */ create_info.alias= create_table->alias; -#ifdef HAVE_READLINK - /* Fix names if symlinked tables */ + /* Fix names if symlinked or relocated tables */ if (append_file_to_dir(thd, &create_info.data_file_name, create_table->table_name) || append_file_to_dir(thd, &create_info.index_file_name, create_table->table_name)) goto end_with_restore_list; -#endif + /* If no engine type was given, work out the default now rather than at parse-time. === modified file 'sql/sql_show.cc' --- a/sql/sql_show.cc 2012-01-31 15:16:16 +0000 +++ b/sql/sql_show.cc 2012-02-08 12:49:33 +0000 @@ -1426,7 +1426,9 @@ int store_create_info(THD *thd, TABLE_LI handler *file= table->file; TABLE_SHARE *share= table->s; HA_CREATE_INFO create_info; +#ifdef WITH_PARTITION_STORAGE_ENGINE bool show_table_options= FALSE; +#endif /* WITH_PARTITION_STORAGE_ENGINE */ bool foreign_db_mode= (thd->variables.sql_mode & (MODE_POSTGRESQL | MODE_ORACLE | MODE_MSSQL | @@ -1639,7 +1641,9 @@ int store_create_info(THD *thd, TABLE_LI packet->append(STRING_WITH_LEN("\n)")); if (!(thd->variables.sql_mode & MODE_NO_TABLE_OPTIONS) && !foreign_db_mode) { +#ifdef WITH_PARTITION_STORAGE_ENGINE show_table_options= TRUE; +#endif /* WITH_PARTITION_STORAGE_ENGINE */ /* TABLESPACE and STORAGE */ if (share->tablespace || === modified file 'sql/sql_table.cc' --- a/sql/sql_table.cc 2012-01-31 15:16:16 +0000 +++ b/sql/sql_table.cc 2012-02-08 13:10:23 +0000 @@ -4431,7 +4431,6 @@ bool mysql_create_table_no_lock(THD *thd THD_STAGE_INFO(thd, stage_creating_table); -#ifdef HAVE_READLINK { size_t dirlen; char dirpath[FN_REFLEN]; @@ -4478,8 +4477,7 @@ bool mysql_create_table_no_lock(THD *thd } #endif /* WITH_PARTITION_STORAGE_ENGINE */ - if (!my_use_symdir || (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE)) -#endif /* HAVE_READLINK */ + if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) { if (create_info->data_file_name) push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, @@ -6208,8 +6206,26 @@ bool mysql_alter_table(THD *thd,char *ne } else { + MDL_request_list mdl_requests; + MDL_request target_db_mdl_request; + target_mdl_request.init(MDL_key::TABLE, new_db, new_name, MDL_EXCLUSIVE, MDL_TRANSACTION); + mdl_requests.push_front(&target_mdl_request); + + /* + If we are moving the table to a different database, we also + need IX lock on the database name so that the target database + is protected by MDL while the table is moved. + */ + if (new_db != db) + { + target_db_mdl_request.init(MDL_key::SCHEMA, new_db, "", + MDL_INTENTION_EXCLUSIVE, + MDL_TRANSACTION); + mdl_requests.push_front(&target_db_mdl_request); + } + /* Global intention exclusive lock must have been already acquired when table to be altered was open, so there is no need to do it here. @@ -6218,14 +6234,10 @@ bool mysql_alter_table(THD *thd,char *ne "", "", MDL_INTENTION_EXCLUSIVE)); - if (thd->mdl_context.try_acquire_lock(&target_mdl_request)) + if (thd->mdl_context.acquire_locks(&mdl_requests, + thd->variables.lock_wait_timeout)) DBUG_RETURN(TRUE); - if (target_mdl_request.ticket == NULL) - { - /* Table exists and is locked by some thread. */ - my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_alias); - DBUG_RETURN(TRUE); - } + DEBUG_SYNC(thd, "locked_table_name"); /* Table maybe does not exist, but we got an exclusive lock === modified file 'storage/archive/ha_archive.cc' --- a/storage/archive/ha_archive.cc 2012-02-07 11:03:11 +0000 +++ b/storage/archive/ha_archive.cc 2012-02-07 23:33:54 +0000 @@ -737,12 +737,12 @@ void ha_archive::frm_load(const char *na { if (!mysql_file_fstat(frm_file, &file_stat, MYF(MY_WME))) { - frm_ptr= (uchar *) my_malloc(sizeof(uchar) * file_stat.st_size, MYF(0)); + frm_ptr= (uchar *) my_malloc(sizeof(uchar) * (size_t) file_stat.st_size, MYF(0)); if (frm_ptr) { - if (my_read(frm_file, frm_ptr, file_stat.st_size, MYF(0)) == + if (my_read(frm_file, frm_ptr, (size_t) file_stat.st_size, MYF(0)) == (size_t) file_stat.st_size) - azwrite_frm(dst, (char *) frm_ptr, file_stat.st_size); + azwrite_frm(dst, (char *) frm_ptr, (size_t) file_stat.st_size); my_free(frm_ptr); } } @@ -831,7 +831,10 @@ int ha_archive::create(const char *name, /* We reuse name_buff since it is available. */ - if (create_info->data_file_name && create_info->data_file_name[0] != '#') +#ifdef HAVE_READLINK + if (my_use_symdir && + create_info->data_file_name && + create_info->data_file_name[0] != '#') { DBUG_PRINT("ha_archive", ("archive will create stream file %s", create_info->data_file_name)); @@ -842,12 +845,29 @@ int ha_archive::create(const char *name, MY_REPLACE_EXT | MY_UNPACK_FILENAME); } else +#endif /* HAVE_READLINK */ { + if (create_info->data_file_name) + { + push_warning_printf(table_arg->in_use, Sql_condition::WARN_LEVEL_WARN, + WARN_OPTION_IGNORED, + ER_DEFAULT(WARN_OPTION_IGNORED), + "DATA DIRECTORY"); + } fn_format(name_buff, name, "", ARZ, MY_REPLACE_EXT | MY_UNPACK_FILENAME); linkname[0]= 0; } + /* Archive engine never uses INDEX DIRECTORY. */ + if (create_info->index_file_name) + { + push_warning_printf(table_arg->in_use, Sql_condition::WARN_LEVEL_WARN, + WARN_OPTION_IGNORED, + ER_DEFAULT(WARN_OPTION_IGNORED), + "INDEX DIRECTORY"); + } + /* There is a chance that the file was "discovered". In this case just use whatever file is there. === modified file 'storage/innobase/handler/ha_innodb.cc' --- a/storage/innobase/handler/ha_innodb.cc 2012-02-06 11:04:33 +0000 +++ b/storage/innobase/handler/ha_innodb.cc 2012-02-08 13:10:23 +0000 @@ -35,6 +35,7 @@ this program; if not, write to the Free // EXPLAIN_FILENAME_MAX_EXTRA_LENGTH #include // PROCESS_ACL +#include // DEBUG_SYNC #include #include @@ -9475,6 +9476,8 @@ ha_innobase::rename_table( error = innobase_rename_table(trx, from, to, TRUE); + DEBUG_SYNC(thd, "after_innobase_rename_table"); + /* Tell the InnoDB server that there might be work for utility threads: */ === modified file 'storage/myisam/ha_myisam.cc' --- a/storage/myisam/ha_myisam.cc 2012-02-02 12:48:48 +0000 +++ b/storage/myisam/ha_myisam.cc 2012-02-07 23:33:54 +0000 @@ -1942,10 +1942,27 @@ int ha_myisam::create(const char *name, (ulonglong) 0); create_info.data_file_length= ((ulonglong) share->max_rows * share->avg_row_length); - create_info.data_file_name= ha_create_info->data_file_name; - create_info.index_file_name= ha_create_info->index_file_name; create_info.language= share->table_charset->number; +#ifdef HAVE_READLINK + if (my_use_symdir) + { + create_info.data_file_name= ha_create_info->data_file_name; + create_info.index_file_name= ha_create_info->index_file_name; + } + else +#endif /* HAVE_READLINK */ + { + if (ha_create_info->data_file_name) + push_warning_printf(table_arg->in_use, Sql_condition::WARN_LEVEL_WARN, + WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED), + "DATA DIRECTORY"); + if (ha_create_info->index_file_name) + push_warning_printf(table_arg->in_use, Sql_condition::WARN_LEVEL_WARN, + WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED), + "INDEX DIRECTORY"); + } + if (ha_create_info->options & HA_LEX_CREATE_TMP_TABLE) create_flags|= HA_CREATE_TMP_TABLE; if (ha_create_info->options & HA_CREATE_KEEP_FILES) No bundle (reason: useless for push emails).