3224 Tor Didriksen 2010-10-04 [merge]
merge -r 3250..3259 from next-mr-opt-backporting
modified:
mysql-test/r/join_cache_jcl2.result
mysql-test/r/join_cache_jcl3.result
mysql-test/r/join_cache_jcl4.result
mysql-test/r/order_by_icp_mrr.result
mysql-test/r/select_all_jcl6.result
mysql-test/r/select_icp_mrr.result
mysql-test/r/select_icp_mrr_jcl6.result
mysql-test/r/select_none_jcl6.result
mysql-test/r/subquery_all_jcl6.result
mysql-test/r/subquery_nomat_nosj.result
mysql-test/r/subquery_nomat_nosj_jcl6.result
mysql-test/r/subquery_none_jcl6.result
sql/sql_select.cc
sql/sql_select.h
3223 Tor Didriksen 2010-09-30 [merge]
Merge next-mr-bugfixing => next-mr-opt-team
removed:
mysql-test/suite/perfschema/r/ddl_threads.result
mysql-test/suite/perfschema/r/dml_threads.result
mysql-test/suite/perfschema/t/ddl_threads.test
mysql-test/suite/perfschema/t/dml_threads.test
mysql-test/suite/perfschema/t/schema.test
storage/perfschema/table_threads.cc
storage/perfschema/table_threads.h
added:
mysql-test/suite/perfschema/include/schema.inc
mysql-test/suite/perfschema/r/ddl_setup_actors.result
mysql-test/suite/perfschema/r/ddl_threads.result
mysql-test/suite/perfschema/r/dml_setup_actors.result
mysql-test/suite/perfschema/r/dml_threads.result
mysql-test/suite/perfschema/r/schema_lc0.result
mysql-test/suite/perfschema/r/schema_lc1.result
mysql-test/suite/perfschema/r/schema_lc2.result
mysql-test/suite/perfschema/r/setup_actors.result
mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
mysql-test/suite/perfschema/r/threads_events.result
mysql-test/suite/perfschema/r/threads_innodb.result
mysql-test/suite/perfschema/r/threads_insert_delayed.result
mysql-test/suite/perfschema/r/threads_mysql.result
mysql-test/suite/perfschema/t/ddl_setup_actors.test
mysql-test/suite/perfschema/t/ddl_threads.test
mysql-test/suite/perfschema/t/dml_setup_actors.test
mysql-test/suite/perfschema/t/dml_threads.test
mysql-test/suite/perfschema/t/schema_lc0.test
mysql-test/suite/perfschema/t/schema_lc1.test
mysql-test/suite/perfschema/t/schema_lc2.test
mysql-test/suite/perfschema/t/setup_actors.test
mysql-test/suite/perfschema/t/start_server_no_setup_actors-master.opt
mysql-test/suite/perfschema/t/start_server_no_setup_actors.test
mysql-test/suite/perfschema/t/threads_innodb.test
mysql-test/suite/perfschema/t/threads_insert_delayed.test
mysql-test/suite/perfschema/t/threads_mysql-master.opt
mysql-test/suite/perfschema/t/threads_mysql.test
mysql-test/suite/sys_vars/r/pfs_setup_actors_size_basic.result
mysql-test/suite/sys_vars/t/pfs_setup_actors_size_basic-master.opt
mysql-test/suite/sys_vars/t/pfs_setup_actors_size_basic.test
storage/perfschema/pfs_defaults.cc
storage/perfschema/pfs_defaults.h
storage/perfschema/pfs_setup_actor.cc
storage/perfschema/pfs_setup_actor.h
storage/perfschema/table_setup_actors.cc
storage/perfschema/table_setup_actors.h
storage/perfschema/table_threads.cc
storage/perfschema/table_threads.h
modified:
BUILD/build_mccge.sh
BUILD/check-cpu
CMakeLists.txt
client/CMakeLists.txt
client/mysqltest.cc
cmake/cmake_parse_arguments.cmake
cmake/install_macros.cmake
cmake/libutils.cmake
cmake/mysql_add_executable.cmake
cmake/plugin.cmake
config/ac-macros/maintainer.m4
include/CMakeLists.txt
include/Makefile.am
include/atomic/x86-gcc.h
include/mysql.h
include/mysql.h.pp
include/mysql/psi/psi.h
include/mysql/psi/psi_abi_v1.h.pp
libmysql/libmysql.c
libmysqld/lib_sql.cc
mysql-test/include/index_merge_ror_cpk.inc
mysql-test/include/order_by.inc
mysql-test/include/select.inc
mysql-test/lib/mtr_cases.pm
mysql-test/mysql-test-run.pl
mysql-test/r/gis.result
mysql-test/r/index_merge_innodb.result
mysql-test/r/index_merge_myisam.result
mysql-test/r/information_schema.result
mysql-test/r/join_cache_jcl1.result
mysql-test/r/multi_update.result
mysql-test/r/mysqld--help-notwin.result
mysql-test/r/mysqld--help-win.result
mysql-test/r/mysqltest.result
mysql-test/r/order_by_all.result
mysql-test/r/order_by_none.result
mysql-test/r/partition.result
mysql-test/r/partition_column.result
mysql-test/r/partition_column_prune.result
mysql-test/r/partition_hash.result
mysql-test/r/partition_innodb.result
mysql-test/r/partition_pruning.result
mysql-test/r/partition_range.result
mysql-test/r/row.result
mysql-test/r/select_all.result
mysql-test/r/select_none.result
mysql-test/r/sp-destruct.result
mysql-test/r/subquery_all.result
mysql-test/r/subquery_none.result
mysql-test/r/trigger_notembedded.result
mysql-test/r/type_newdecimal.result
mysql-test/r/type_timestamp.result
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
mysql-test/suite/innodb/r/innodb_mysql.result
mysql-test/suite/innodb/t/innodb_mysql.test
mysql-test/suite/parts/r/partition_alter3_innodb.result
mysql-test/suite/parts/r/partition_alter3_myisam.result
mysql-test/suite/perfschema/include/setup_helper.inc
mysql-test/suite/perfschema/include/start_server_common.inc
mysql-test/suite/perfschema/r/dml_setup_instruments.result
mysql-test/suite/perfschema/r/func_file_io.result
mysql-test/suite/perfschema/r/information_schema.result
mysql-test/suite/perfschema/r/pfs_upgrade_lc0.result
mysql-test/suite/perfschema/r/pfs_upgrade_lc1.result
mysql-test/suite/perfschema/r/pfs_upgrade_lc2.result
mysql-test/suite/perfschema/r/privilege_table_io.result
mysql-test/suite/perfschema/r/selects.result
mysql-test/suite/perfschema/r/start_server_no_cond_class.result
mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
mysql-test/suite/perfschema/r/start_server_no_file_class.result
mysql-test/suite/perfschema/r/start_server_no_file_inst.result
mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
mysql-test/suite/perfschema/r/start_server_no_table_inst.result
mysql-test/suite/perfschema/r/start_server_no_thread_class.result
mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
mysql-test/suite/perfschema/r/start_server_nothing.result
mysql-test/suite/perfschema/r/start_server_off.result
mysql-test/suite/perfschema/r/start_server_on.result
mysql-test/suite/perfschema/t/disabled.def
mysql-test/suite/perfschema/t/func_file_io.test
mysql-test/suite/perfschema/t/selects.test
mysql-test/suite/perfschema/t/start_server_nothing.test
mysql-test/suite/perfschema/t/thread_cache.test
mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result
mysql-test/suite/rpl/r/rpl_change_master_dbug.result
mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result
mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result
mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result
mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result
mysql-test/suite/rpl/r/rpl_row_mixing_engines.result
mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
mysql-test/suite/rpl/t/rpl_change_master_dbug.test
mysql-test/t/gis.test
mysql-test/t/information_schema.test
mysql-test/t/log_tables_debug.test
mysql-test/t/multi_update.test
mysql-test/t/mysqltest.test
mysql-test/t/partition.test
mysql-test/t/partition_pruning.test
mysql-test/t/row.test
mysql-test/t/sp-destruct.test
mysql-test/t/trigger_notembedded.test
mysql-test/t/type_newdecimal.test
mysql-test/t/type_timestamp.test
mysql-test/valgrind.supp
mysys/my_getopt.c
scripts/CMakeLists.txt
scripts/make_win_bin_dist
scripts/mysql_system_tables.sql
sql/binlog.cc
sql/event_scheduler.cc
sql/field.cc
sql/ha_ndbcluster_binlog.cc
sql/ha_partition.cc
sql/ha_partition.h
sql/item.cc
sql/item_cmpfunc.cc
sql/item_subselect.cc
sql/log.cc
sql/mdl.cc
sql/mdl.h
sql/net_serv.cc
sql/opt_range.cc
sql/rpl_master.cc
sql/rpl_slave.cc
sql/sp.cc
sql/spatial.cc
sql/sql_base.cc
sql/sql_base.h
sql/sql_cache.cc
sql/sql_class.cc
sql/sql_class.h
sql/sql_connect.cc
sql/sql_insert.cc
sql/sql_parse.cc
sql/sql_prepare.cc
sql/sql_select.cc
sql/sql_show.cc
sql/sql_table.cc
sql/sql_trigger.cc
sql/sys_vars.cc
sql/table.cc
storage/myisam/mi_range.c
storage/myisam/mi_search.c
storage/myisam/rt_index.c
storage/myisam/rt_split.c
storage/perfschema/CMakeLists.txt
storage/perfschema/Makefile.am
storage/perfschema/ha_perfschema.cc
storage/perfschema/ha_perfschema.h
storage/perfschema/pfs.cc
storage/perfschema/pfs_engine_table.cc
storage/perfschema/pfs_engine_table.h
storage/perfschema/pfs_instr.cc
storage/perfschema/pfs_instr.h
storage/perfschema/pfs_lock.h
storage/perfschema/pfs_server.cc
storage/perfschema/pfs_server.h
storage/perfschema/table_events_waits.cc
storage/perfschema/table_events_waits.h
storage/perfschema/table_events_waits_summary.cc
storage/perfschema/table_events_waits_summary.h
storage/perfschema/table_ews_global_by_event_name.cc
storage/perfschema/table_file_instances.cc
storage/perfschema/table_file_instances.h
storage/perfschema/table_file_summary.cc
storage/perfschema/table_file_summary.h
storage/perfschema/table_performance_timers.cc
storage/perfschema/table_setup_consumers.cc
storage/perfschema/table_setup_instruments.cc
storage/perfschema/table_setup_timers.cc
storage/perfschema/table_sync_instances.cc
storage/perfschema/table_sync_instances.h
storage/perfschema/unittest/pfs-t.cc
storage/perfschema/unittest/pfs_instr-oom-t.cc
storage/perfschema/unittest/pfs_instr-t.cc
storage/perfschema/unittest/stub_pfs_global.h
tests/mysql_client_test.c
=== modified file 'mysql-test/r/join_cache_jcl2.result'
--- a/mysql-test/r/join_cache_jcl2.result 2010-08-11 13:28:19 +0000
+++ b/mysql-test/r/join_cache_jcl2.result 2010-09-30 14:57:06 +0000
@@ -2219,7 +2219,7 @@ GROUP BY t1.col_int_key
ORDER BY t1.col_int_key, t1.col_datetime
LIMIT 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL col_int_key 5 NULL 2 Using temporary; Using filesort
+1 SIMPLE t1 index NULL col_int_key 5 NULL 3 Using temporary; Using filesort
1 SIMPLE t2 ref col_int_key col_int_key 5 const 1 Using where
SELECT t1.col_int_key, t1.col_datetime
FROM t1,t2
=== modified file 'mysql-test/r/join_cache_jcl3.result'
--- a/mysql-test/r/join_cache_jcl3.result 2010-08-11 13:28:19 +0000
+++ b/mysql-test/r/join_cache_jcl3.result 2010-09-30 14:57:06 +0000
@@ -2219,7 +2219,7 @@ GROUP BY t1.col_int_key
ORDER BY t1.col_int_key, t1.col_datetime
LIMIT 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL col_int_key 5 NULL 2 Using temporary; Using filesort
+1 SIMPLE t1 index NULL col_int_key 5 NULL 3 Using temporary; Using filesort
1 SIMPLE t2 ref col_int_key col_int_key 5 const 1 Using where
SELECT t1.col_int_key, t1.col_datetime
FROM t1,t2
=== modified file 'mysql-test/r/join_cache_jcl4.result'
--- a/mysql-test/r/join_cache_jcl4.result 2010-08-11 13:28:19 +0000
+++ b/mysql-test/r/join_cache_jcl4.result 2010-09-30 14:57:06 +0000
@@ -2219,7 +2219,7 @@ GROUP BY t1.col_int_key
ORDER BY t1.col_int_key, t1.col_datetime
LIMIT 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL col_int_key 5 NULL 2 Using temporary; Using filesort
+1 SIMPLE t1 index NULL col_int_key 5 NULL 3 Using temporary; Using filesort
1 SIMPLE t2 ref col_int_key col_int_key 5 const 1 Using where
SELECT t1.col_int_key, t1.col_datetime
FROM t1,t2
=== modified file 'mysql-test/r/order_by_icp_mrr.result'
--- a/mysql-test/r/order_by_icp_mrr.result 2010-07-04 15:07:55 +0000
+++ b/mysql-test/r/order_by_icp_mrr.result 2010-09-30 14:57:06 +0000
@@ -1618,6 +1618,27 @@ id select_type table type possible_keys
1 SIMPLE t1 range a a 5 NULL 2 Using index condition; Using MRR; Using temporary; Using filesort
1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using join buffer (BNL, regular buffers)
DROP TABLE t1, t2;
+#
+# Bug #50394: Regression in EXPLAIN with index scan, LIMIT, GROUP BY and
+# ORDER BY computed col
+#
+CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL, KEY( a, b ) );
+INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
+INSERT INTO t1 SELECT a + 5, b + 5 FROM t1;
+CREATE TABLE t2( a INT PRIMARY KEY, b INT );
+INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
+INSERT INTO t2 SELECT a + 5, b + 5 FROM t2;
+EXPLAIN
+SELECT count(*) AS c, t1.a
+FROM t1 JOIN t2 ON t1.b = t2.a
+WHERE t2.b = 1
+GROUP BY t1.a
+ORDER by c
+LIMIT 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 8 NULL 10 Using index; Using temporary; Using filesort
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using where
+DROP TABLE t1, t2;
End of 5.1 tests
#
# Bug #38745: MySQL 5.1 optimizer uses filesort for ORDER BY
=== modified file 'mysql-test/r/select_all_jcl6.result'
--- a/mysql-test/r/select_all_jcl6.result 2010-09-09 18:21:34 +0000
+++ b/mysql-test/r/select_all_jcl6.result 2010-09-30 15:01:59 +0000
@@ -4435,11 +4435,6 @@ SELECT 1 FROM t1 WHERE a <> 1 AND NOT
ROW(1,a) <=> ROW(1,(SELECT 1 FROM t1))
INTO @var0;
ERROR 21000: Subquery returns more than 1 row
-SELECT 1 FROM t1 WHERE a <> 1 AND NOT
-ROW(a,a) <=> ROW((SELECT 1 FROM t1 WHERE 1=2),(SELECT 1 FROM t1));
-1
-1
-1
DROP TABLE t1;
#
# Bug #48458: simple query tries to allocate enormous amount of
=== modified file 'mysql-test/r/select_icp_mrr.result'
--- a/mysql-test/r/select_icp_mrr.result 2010-09-09 18:21:34 +0000
+++ b/mysql-test/r/select_icp_mrr.result 2010-09-30 15:01:59 +0000
@@ -4431,11 +4431,6 @@ SELECT 1 FROM t1 WHERE a <> 1 AND NOT
ROW(1,a) <=> ROW(1,(SELECT 1 FROM t1))
INTO @var0;
ERROR 21000: Subquery returns more than 1 row
-SELECT 1 FROM t1 WHERE a <> 1 AND NOT
-ROW(a,a) <=> ROW((SELECT 1 FROM t1 WHERE 1=2),(SELECT 1 FROM t1));
-1
-1
-1
DROP TABLE t1;
#
# Bug #48458: simple query tries to allocate enormous amount of
=== modified file 'mysql-test/r/select_icp_mrr_jcl6.result'
--- a/mysql-test/r/select_icp_mrr_jcl6.result 2010-09-09 18:21:34 +0000
+++ b/mysql-test/r/select_icp_mrr_jcl6.result 2010-09-30 15:01:59 +0000
@@ -4435,11 +4435,6 @@ SELECT 1 FROM t1 WHERE a <> 1 AND NOT
ROW(1,a) <=> ROW(1,(SELECT 1 FROM t1))
INTO @var0;
ERROR 21000: Subquery returns more than 1 row
-SELECT 1 FROM t1 WHERE a <> 1 AND NOT
-ROW(a,a) <=> ROW((SELECT 1 FROM t1 WHERE 1=2),(SELECT 1 FROM t1));
-1
-1
-1
DROP TABLE t1;
#
# Bug #48458: simple query tries to allocate enormous amount of
=== modified file 'mysql-test/r/select_none_jcl6.result'
--- a/mysql-test/r/select_none_jcl6.result 2010-09-09 18:21:34 +0000
+++ b/mysql-test/r/select_none_jcl6.result 2010-09-30 15:01:59 +0000
@@ -4434,11 +4434,6 @@ SELECT 1 FROM t1 WHERE a <> 1 AND NOT
ROW(1,a) <=> ROW(1,(SELECT 1 FROM t1))
INTO @var0;
ERROR 21000: Subquery returns more than 1 row
-SELECT 1 FROM t1 WHERE a <> 1 AND NOT
-ROW(a,a) <=> ROW((SELECT 1 FROM t1 WHERE 1=2),(SELECT 1 FROM t1));
-1
-1
-1
DROP TABLE t1;
#
# Bug #48458: simple query tries to allocate enormous amount of
=== modified file 'mysql-test/r/subquery_all_jcl6.result'
--- a/mysql-test/r/subquery_all_jcl6.result 2010-09-01 13:46:08 +0000
+++ b/mysql-test/r/subquery_all_jcl6.result 2010-09-30 15:08:22 +0000
@@ -927,7 +927,7 @@ select a, (select a,b,c from t1 where t1
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a') (select c from t1 where a=t2.a)
1 1 a
2 0 b
-NULL 0 NULL
+NULL NULL NULL
select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2;
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b') (select c from t1 where a=t2.a)
1 0 a
@@ -937,7 +937,7 @@ select a, (select a,b,c from t1 where t1
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c') (select c from t1 where a=t2.a)
1 0 a
2 0 b
-NULL 0 NULL
+NULL NULL NULL
drop table t1,t2;
create table t1 (a int, b real, c varchar(10));
insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b');
=== modified file 'mysql-test/r/subquery_nomat_nosj.result'
--- a/mysql-test/r/subquery_nomat_nosj.result 2010-09-01 13:46:08 +0000
+++ b/mysql-test/r/subquery_nomat_nosj.result 2010-09-30 15:08:22 +0000
@@ -923,7 +923,7 @@ select a, (select a,b,c from t1 where t1
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a') (select c from t1 where a=t2.a)
1 1 a
2 0 b
-NULL 0 NULL
+NULL NULL NULL
select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2;
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b') (select c from t1 where a=t2.a)
1 0 a
@@ -933,7 +933,7 @@ select a, (select a,b,c from t1 where t1
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c') (select c from t1 where a=t2.a)
1 0 a
2 0 b
-NULL 0 NULL
+NULL NULL NULL
drop table t1,t2;
create table t1 (a int, b real, c varchar(10));
insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b');
=== modified file 'mysql-test/r/subquery_nomat_nosj_jcl6.result'
--- a/mysql-test/r/subquery_nomat_nosj_jcl6.result 2010-09-01 13:46:08 +0000
+++ b/mysql-test/r/subquery_nomat_nosj_jcl6.result 2010-09-30 15:08:22 +0000
@@ -927,7 +927,7 @@ select a, (select a,b,c from t1 where t1
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a') (select c from t1 where a=t2.a)
1 1 a
2 0 b
-NULL 0 NULL
+NULL NULL NULL
select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2;
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b') (select c from t1 where a=t2.a)
1 0 a
@@ -937,7 +937,7 @@ select a, (select a,b,c from t1 where t1
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c') (select c from t1 where a=t2.a)
1 0 a
2 0 b
-NULL 0 NULL
+NULL NULL NULL
drop table t1,t2;
create table t1 (a int, b real, c varchar(10));
insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b');
=== modified file 'mysql-test/r/subquery_none_jcl6.result'
--- a/mysql-test/r/subquery_none_jcl6.result 2010-09-01 13:46:08 +0000
+++ b/mysql-test/r/subquery_none_jcl6.result 2010-09-30 15:08:22 +0000
@@ -926,7 +926,7 @@ select a, (select a,b,c from t1 where t1
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a') (select c from t1 where a=t2.a)
1 1 a
2 0 b
-NULL 0 NULL
+NULL NULL NULL
select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2;
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b') (select c from t1 where a=t2.a)
1 0 a
@@ -936,7 +936,7 @@ select a, (select a,b,c from t1 where t1
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c') (select c from t1 where a=t2.a)
1 0 a
2 0 b
-NULL 0 NULL
+NULL NULL NULL
drop table t1,t2;
create table t1 (a int, b real, c varchar(10));
insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b');
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2010-09-29 14:28:09 +0000
+++ b/sql/sql_select.cc 2010-09-30 14:53:11 +0000
@@ -5846,7 +5846,6 @@ add_key_part(DYNAMIC_ARRAY *keyuse_array
{
Field *field=key_field->field;
TABLE *form= field->table;
- KEYUSE keyuse;
if (key_field->eq_func && !(key_field->optimize & KEY_OPTIMIZE_EXISTS))
{
@@ -5862,20 +5861,21 @@ add_key_part(DYNAMIC_ARRAY *keyuse_array
{
if (field->eq(form->key_info[key].key_part[part].field))
{
- keyuse.table= field->table;
- keyuse.val = key_field->val;
- keyuse.key = key;
- keyuse.keypart=part;
- keyuse.keypart_map= (key_part_map) 1 << part;
- keyuse.used_tables=key_field->val->used_tables();
- keyuse.optimize= key_field->optimize & KEY_OPTIMIZE_REF_OR_NULL;
- keyuse.null_rejecting= key_field->null_rejecting;
- keyuse.cond_guard= key_field->cond_guard;
- keyuse.sj_pred_no= key_field->sj_pred_no;
- if (insert_dynamic(keyuse_array,(uchar*) &keyuse))
- return TRUE;
+ KEYUSE keyuse;
+ keyuse.table= field->table;
+ keyuse.val= key_field->val;
+ keyuse.used_tables= key_field->val->used_tables();
+ keyuse.key= key;
+ keyuse.keypart= part;
+ keyuse.optimize= key_field->optimize & KEY_OPTIMIZE_REF_OR_NULL;
+ keyuse.keypart_map= (key_part_map) 1 << part;
/* This will be set accordingly in optimize_keyuse */
keyuse.ref_table_rows= ~(ha_rows) 0;
+ keyuse.null_rejecting= key_field->null_rejecting;
+ keyuse.cond_guard= key_field->cond_guard;
+ keyuse.sj_pred_no= key_field->sj_pred_no;
+ if (insert_dynamic(keyuse_array, (uchar*) &keyuse))
+ return TRUE;
}
}
}
@@ -10689,7 +10689,7 @@ bool setup_sj_materialization(JOIN_TAB *
temptable.
*/
TABLE_REF *tab_ref;
- if (!(tab_ref= (TABLE_REF*) thd->alloc(sizeof(TABLE_REF))))
+ if (!(tab_ref= new (thd->mem_root) TABLE_REF))
DBUG_RETURN(TRUE); /* purecov: inspected */
tab_ref->key= 0; /* The only temp table index. */
tab_ref->key_length= tmp_key->key_length;
@@ -10702,10 +10702,8 @@ bool setup_sj_materialization(JOIN_TAB *
(Item**) thd->alloc(sizeof(Item*) * tmp_key_parts)))
DBUG_RETURN(TRUE); /* purecov: inspected */
- tab_ref->key_buff2=tab_ref->key_buff+ALIGN_SIZE(tmp_key->key_length);
- tab_ref->key_err=1;
+ tab_ref->key_buff2= tab_ref->key_buff+ALIGN_SIZE(tmp_key->key_length);
tab_ref->null_rejecting= 1;
- tab_ref->disable_cache= FALSE;
KEY_PART_INFO *cur_key_part= tmp_key->key_part;
store_key **ref_key= tab_ref->key_copy;
@@ -10896,7 +10894,7 @@ make_join_readinfo(JOIN *join, ulonglong
{
if (!(tab->loosescan_buf= (uchar*)join->thd->alloc(tab->
loosescan_key_len)))
- return TRUE; /* purecov: inspected */
+ DBUG_RETURN(TRUE); /* purecov: inspected */
}
if (sj_is_materialize_strategy(join->best_positions[i].sj_strategy))
{
@@ -10909,7 +10907,7 @@ make_join_readinfo(JOIN *join, ulonglong
tab[-1].next_select= sub_select_sjm;
if (setup_sj_materialization(tab))
- return TRUE;
+ DBUG_RETURN(TRUE);
}
switch (tab->type) {
case JT_EQ_REF:
=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h 2010-09-22 11:37:38 +0000
+++ b/sql/sql_select.h 2010-09-23 12:16:36 +0000
@@ -72,7 +72,7 @@ typedef struct keyuse_t {
class store_key;
-typedef struct st_table_ref
+typedef struct st_table_ref : public Sql_alloc
{
bool key_err;
/** True if something was read into buffer in join_read_key. */
@@ -116,6 +116,25 @@ typedef struct st_table_ref
*/
bool disable_cache;
+ st_table_ref()
+ : key_err(TRUE),
+ has_record(FALSE),
+ key_parts(0),
+ key_length(0),
+ key(-1),
+ key_buff(NULL),
+ key_buff2(NULL),
+ key_copy(NULL),
+ items(NULL),
+ cond_guards(NULL),
+ null_rejecting(0),
+ depend_map(0),
+ null_ref_key(NULL),
+ use_count(0),
+ disable_cache(FALSE)
+ {
+ }
+
/**
@returns whether the reference contains NULL values which could never give
a match.
Attachment: [text/bzr-bundle] bzr/tor.didriksen@oracle.com-20101004131035-7qwh7ilpy1uh1ziq.bundle
| Thread |
|---|
| • bzr push into mysql-next-mr-opt-team branch (tor.didriksen:3223 to 3224) | Tor Didriksen | 4 Oct |