summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergeyV@selena. <>2005-12-01 23:47:44 +0300
committerSergeyV@selena. <>2005-12-01 23:47:44 +0300
commit29941c07edf6136f44fa48e59d48ccc700a20dc9 (patch)
tree34b66e955da4607014009473483bac5e9b91291e
parent27e962764d670e79734c19ca1200d1e861ed63cb (diff)
parent22b43351f823b08123b19aeee4c8f7bfa365bd22 (diff)
downloadmariadb-git-29941c07edf6136f44fa48e59d48ccc700a20dc9.tar.gz
Merge selena.:H:/MYSQL/bkt/mysql-5.0
into selena.:H:/MYSQL/bkt/mysql-5.1
-rw-r--r--mysql-test/r/analyze.result9
-rw-r--r--mysql-test/r/sp.result24
-rw-r--r--mysql-test/t/analyze.test14
-rw-r--r--mysql-test/t/sp.test31
-rw-r--r--sql/sp_head.cc2
-rw-r--r--sql/sql_class.cc2
-rw-r--r--sql/sql_class.h2
-rw-r--r--storage/myisam/mi_check.c3
8 files changed, 84 insertions, 3 deletions
diff --git a/mysql-test/r/analyze.result b/mysql-test/r/analyze.result
index 796b382f5d6..17686d597a4 100644
--- a/mysql-test/r/analyze.result
+++ b/mysql-test/r/analyze.result
@@ -30,6 +30,15 @@ check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
+create table t1 (a mediumtext, fulltext key key1(a)) charset utf8 collate utf8_general_ci engine myisam;
+insert into t1 values ('hello');
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Table is already up to date
+drop table t1;
CREATE TABLE t1 (a int);
prepare stmt1 from "SELECT * FROM t1 PROCEDURE ANALYSE()";
execute stmt1;
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 694cf903d35..454ff0b615f 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -4046,4 +4046,28 @@ boo
2
drop procedure bug14643_1|
drop procedure bug14643_2|
+drop procedure if exists bug14304|
+drop table if exists t3, t4|
+create table t3(a int primary key auto_increment)|
+create table t4(a int primary key auto_increment)|
+create procedure bug14304()
+begin
+insert into t3 set a=null;
+insert into t4 set a=null;
+insert into t4 set a=null;
+insert into t4 set a=null;
+insert into t4 set a=null;
+insert into t4 set a=null;
+insert into t4 select null as a;
+insert into t3 set a=null;
+insert into t3 set a=null;
+select * from t3;
+end|
+call bug14304()|
+a
+1
+2
+3
+drop procedure bug14304|
+drop table t3, t4|
drop table t1,t2;
diff --git a/mysql-test/t/analyze.test b/mysql-test/t/analyze.test
index 5d653b65579..656ff752c9b 100644
--- a/mysql-test/t/analyze.test
+++ b/mysql-test/t/analyze.test
@@ -39,6 +39,20 @@ check table t1;
drop table t1;
+# Bug #14902 ANALYZE TABLE fails to recognize up-to-date tables
+# minimal test case to get an error.
+# The problem is happening when analysing table with FT index that
+# contains stopwords only. The first execution of analyze table should
+# mark index statistics as up to date so that next execution of this
+# statement will end up with Table is up to date status.
+create table t1 (a mediumtext, fulltext key key1(a)) charset utf8 collate utf8_general_ci engine myisam;
+insert into t1 values ('hello');
+
+analyze table t1;
+analyze table t1;
+
+drop table t1;
+
#
# procedure in PS BUG#13673
#
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 5bbe9258461..676cc3cda1e 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -4823,6 +4823,37 @@ call bug14643_2()|
drop procedure bug14643_1|
drop procedure bug14643_2|
+#
+# BUG#14304: auto_increment field incorrect set in SP
+#
+--disable_warnings
+drop procedure if exists bug14304|
+drop table if exists t3, t4|
+--enable_warnings
+
+create table t3(a int primary key auto_increment)|
+create table t4(a int primary key auto_increment)|
+
+create procedure bug14304()
+begin
+ insert into t3 set a=null;
+ insert into t4 set a=null;
+ insert into t4 set a=null;
+ insert into t4 set a=null;
+ insert into t4 set a=null;
+ insert into t4 set a=null;
+ insert into t4 select null as a;
+
+ insert into t3 set a=null;
+ insert into t3 set a=null;
+
+ select * from t3;
+end|
+
+call bug14304()|
+
+drop procedure bug14304|
+drop table t3, t4|
#
# BUG#NNNN: New bug synopsis
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 8b176b03756..90d1ec38e64 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1075,7 +1075,7 @@ int sp_head::execute(THD *thd)
}
/* we should cleanup free_list and memroot, used by instruction */
- thd->free_items();
+ thd->cleanup_after_query();
free_root(&execute_mem_root, MYF(0));
/*
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 43f6c202712..623e6987094 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1951,6 +1951,7 @@ void THD::reset_sub_statement_state(Sub_statement_state *backup,
backup->last_insert_id= last_insert_id;
backup->next_insert_id= next_insert_id;
backup->insert_id_used= insert_id_used;
+ backup->clear_next_insert_id= clear_next_insert_id;
backup->limit_found_rows= limit_found_rows;
backup->examined_row_count= examined_row_count;
backup->sent_row_count= sent_row_count;
@@ -2002,6 +2003,7 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup)
last_insert_id= backup->last_insert_id;
next_insert_id= backup->next_insert_id;
insert_id_used= backup->insert_id_used;
+ clear_next_insert_id= backup->clear_next_insert_id;
limit_found_rows= backup->limit_found_rows;
sent_row_count= backup->sent_row_count;
client_capabilities= backup->client_capabilities;
diff --git a/sql/sql_class.h b/sql/sql_class.h
index cbe4593a7a9..fcc8409546f 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1101,7 +1101,7 @@ public:
ha_rows cuted_fields, sent_row_count, examined_row_count;
ulong client_capabilities;
uint in_sub_stmt;
- bool enable_slow_log, insert_id_used;
+ bool enable_slow_log, insert_id_used, clear_next_insert_id;
my_bool no_send_ok;
SAVEPOINT *savepoints;
};
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c
index 6296193d6b0..9ce1dff51af 100644
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@ -402,7 +402,7 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
full_text_keys++;
if (share->state.key_root[key] == HA_OFFSET_ERROR &&
(info->state->records == 0 || keyinfo->flag & HA_FULLTEXT))
- continue;
+ goto do_stat;
if (!_mi_fetch_keypage(info,keyinfo,share->state.key_root[key],
DFLT_INIT_HITS,info->buff,0))
{
@@ -498,6 +498,7 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
param->max_level);
all_keydata+=param->keydata; all_totaldata+=param->totaldata; key_totlength+=length;
+do_stat:
if (param->testflag & T_STATISTICS)
update_key_parts(keyinfo, rec_per_key_part, param->unique_count,
param->stats_method == MI_STATS_METHOD_IGNORE_NULLS?