summaryrefslogtreecommitdiff
path: root/mysql-test/r/insert_select.result
diff options
context:
space:
mode:
authorunknown <evgen@sunlight.local>2007-09-21 12:09:00 +0400
committerunknown <evgen@sunlight.local>2007-09-21 12:09:00 +0400
commitf7f10959084aa815e1e4f10b6dc02aafa9de588b (patch)
tree94d81e991e3a7828c83c40586bbf640a760c86bc /mysql-test/r/insert_select.result
parentad57f91294e80016af10f282202fa5abb788bdc9 (diff)
downloadmariadb-git-f7f10959084aa815e1e4f10b6dc02aafa9de588b.tar.gz
Bug#30384: Having SQL_BUFFER_RESULT option in the CREATE .. KEY(..) .. SELECT
led to creating corrupted index. While execution of the CREATE .. SELECT SQL_BUFFER_RESULT statement the engine->start_bulk_insert function was called twice. On the first call On the first call MyISAM disabled all non-unique indexes and on the second call it decides to not re-enable them because all indexes was disabled. Due to this no indexes was actually created during CREATE TABLE thus producing crashed table. Now the select_inset class has is_bulk_insert_mode flag which prevents calling the start_bulk_insert function twice. The flag is set in the select_create::prepare, select_insert::prepare2 functions and the select_insert class constructor. The flag is reset in the select_insert::send_eof function. mysql-test/t/insert_select.test: A test case is added for the bug#30384: Having SQL_BUFFER_RESULT option in the CREATE .. KEY(..) .. SELECT led to creating corrupted index. mysql-test/r/insert_select.result: A test case is added for the bug#30384: Having SQL_BUFFER_RESULT option in the CREATE .. KEY(..) .. SELECT led to creating corrupted index. sql/sql_class.h: Bug#30384: Having SQL_BUFFER_RESULT option in the CREATE .. KEY(..) .. SELECT led to creating corrupted index. The is_bulk_insert_mode flag is added to the select_insert class. sql/sql_insert.cc: Bug#30384: Having SQL_BUFFER_RESULT option in the CREATE .. KEY(..) .. SELECT led to creating corrupted index. The is_bulk_insert_mode is set in the select_create::prepare, select_insert::prepare2 functions and the select_insert class constructor. The flag is reset in the select_insert::send_eof function.
Diffstat (limited to 'mysql-test/r/insert_select.result')
-rw-r--r--mysql-test/r/insert_select.result12
1 files changed, 12 insertions, 0 deletions
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index d16562d97e2..7a37f49125a 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -830,3 +830,15 @@ id prev_id join_id
3 2 0
4 3 0
DROP TABLE t1,t2;
+#
+# Bug#30384: Having SQL_BUFFER_RESULT option in the
+# CREATE .. KEY(..) .. SELECT led to creating corrupted index.
+#
+create table t1(f1 int);
+insert into t1 values(1),(2),(3);
+create table t2 (key(f1)) engine=myisam select sql_buffer_result f1 from t1;
+check table t2 extended;
+Table Op Msg_type Msg_text
+test.t2 check status OK
+drop table t1,t2;
+##################################################################