From 60af920628c435a5990c3ef7a753d0f374fc12cc Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 26 Nov 2004 02:31:22 +0200 Subject: [PATCH] Fixes while reviewing code (Cleanups and better bug fixes) mysql-test/r/select.result: Fixed test after wrong merge mysql-test/t/select.test: Fixed test after wrong merge scripts/mysql_fix_privilege_tables.sh: Don't read defaults files sql/item_cmpfunc.cc: Fix wrong value for not_null_tables_cache sql/item_cmpfunc.h: Remove wrong patch (flags are set in fix_length_and_dec()) sql/item_func.h: Fix wrong value for not_null_tables_cache sql/slave.cc: Fixed indentation --- mysql-test/r/select.result | 32 +++++++++++++-------------- mysql-test/t/select.test | 2 +- scripts/mysql_fix_privilege_tables.sh | 2 +- sql/item_cmpfunc.cc | 7 +++--- sql/item_cmpfunc.h | 3 --- sql/item_func.h | 2 +- sql/slave.cc | 3 ++- 7 files changed, 25 insertions(+), 26 deletions(-) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 3dd0603ed09..cc90547722f 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2327,22 +2327,6 @@ select * from t2,t3 where t2.s = t3.s; s s two two drop table t1, t2, t3; -CREATE TABLE t1 ( -i int(11) NOT NULL default '0', -c char(10) NOT NULL default '', -PRIMARY KEY (i), -UNIQUE KEY c (c) -) TYPE=MyISAM; -INSERT INTO t1 VALUES (1,'a'); -INSERT INTO t1 VALUES (2,'b'); -INSERT INTO t1 VALUES (3,'c'); -EXPLAIN SELECT i FROM t1 WHERE i=1; -table type possible_keys key key_len ref rows Extra -t1 const PRIMARY PRIMARY 4 const 1 Using index -EXPLAIN SELECT i FROM t1 WHERE i=1; -table type possible_keys key key_len ref rows Extra -t1 const PRIMARY PRIMARY 4 const 1 Using index -DROP TABLE t1; create table t1 (a integer, b integer, index(a), index(b)); create table t2 (c integer, d integer, index(c), index(d)); insert into t1 values (1,2), (2,2), (3,2), (4,2); @@ -2364,3 +2348,19 @@ a b c d 3 2 3 4 4 2 4 4 drop table t1, t2; +CREATE TABLE t1 ( +i int(11) NOT NULL default '0', +c char(10) NOT NULL default '', +PRIMARY KEY (i), +UNIQUE KEY c (c) +) TYPE=MyISAM; +INSERT INTO t1 VALUES (1,'a'); +INSERT INTO t1 VALUES (2,'b'); +INSERT INTO t1 VALUES (3,'c'); +EXPLAIN SELECT i FROM t1 WHERE i=1; +table type possible_keys key key_len ref rows Extra +t1 const PRIMARY PRIMARY 4 const 1 Using index +EXPLAIN SELECT i FROM t1 WHERE i=1; +table type possible_keys key key_len ref rows Extra +t1 const PRIMARY PRIMARY 4 const 1 Using index +DROP TABLE t1; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index f897703789b..e6b1ffbe8d7 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -1887,7 +1887,7 @@ explain select * from t1 left join t2 on a=c where d in (4); select * from t1 left join t2 on a=c where d in (4); explain select * from t1 left join t2 on a=c where d = 4; select * from t1 left join t2 on a=c where d = 4; -drop table t1, t2;R +drop table t1, t2; # # Covering index is mentioned in EXPLAIN output for const tables (bug #5333) diff --git a/scripts/mysql_fix_privilege_tables.sh b/scripts/mysql_fix_privilege_tables.sh index 2fbcd76c318..381cf599e32 100644 --- a/scripts/mysql_fix_privilege_tables.sh +++ b/scripts/mysql_fix_privilege_tables.sh @@ -74,7 +74,7 @@ parse_arguments() parse_arguments "$@" if test -z "$cmd"; then - cmd="$bindir/mysql -f --user=$user --host=$host" + cmd="$bindir/mysql --no-defaults --force --user=$user --host=$host" if test ! -z "$root_password"; then cmd="$cmd --password=$root_password" fi diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index fbc1ad97e76..107a17815ae 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -293,9 +293,9 @@ void Item_func_interval::fix_length_and_dec() } maybe_null=0; max_length=2; used_tables_cache|= item->used_tables(); - not_null_tables_cache&= item->not_null_tables(); + not_null_tables_cache= item->not_null_tables(); with_sum_func= with_sum_func || item->with_sum_func; - const_item_cache&=item->const_item(); + const_item_cache&= item->const_item(); } @@ -1087,7 +1087,8 @@ void Item_func_in::fix_length_and_dec() maybe_null= item->maybe_null; max_length=2; used_tables_cache|= item->used_tables(); - not_null_tables_cache&= item->not_null_tables(); + /* not_null_tables_cache is only dependent on the argument to in */ + not_null_tables_cache= item->not_null_tables(); const_item_cache&= item->const_item(); } diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index d36429ab61e..8f1aa525190 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -432,9 +432,6 @@ class Item_func_in :public Item_int_func { bool res= (item->fix_fields(thd,tlist) || Item_func::fix_fields(thd,tlist)); with_sum_func= with_sum_func || item->with_sum_func; - used_tables_cache|= item->used_tables(); - not_null_tables_cache|= item->not_null_tables(); - const_item_cache&= item->const_item(); return res; } void fix_length_and_dec(); diff --git a/sql/item_func.h b/sql/item_func.h index 8a013f42c05..3627af4ebb1 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -600,7 +600,7 @@ public: { maybe_null=0; max_length=3; used_tables_cache|= item->used_tables(); - not_null_tables_cache&= item->not_null_tables(); + not_null_tables_cache= item->not_null_tables(); const_item_cache&= item->const_item(); with_sum_func= with_sum_func || item->with_sum_func; } diff --git a/sql/slave.cc b/sql/slave.cc index 7e544572755..b0f911e7013 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1637,7 +1637,8 @@ int init_master_info(MASTER_INFO* mi, const char* master_info_fname, position is at the beginning of the file, and will read the "signature" and then fast-forward to the last position read. */ - if (thread_mask & SLAVE_SQL) { + if (thread_mask & SLAVE_SQL) + { my_b_seek(mi->rli.cur_log, (my_off_t) 0); } DBUG_RETURN(0);