summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authoringo@mysql.com <>2005-01-19 21:13:30 +0100
committeringo@mysql.com <>2005-01-19 21:13:30 +0100
commit9a914a00227519859a69b1bad7f2add2fad7c870 (patch)
tree886cb12b82ab9e15cffe0dd94d20966003927f66 /mysql-test
parenta074e676bfb782aae6e5143f8fd7009d314095ec (diff)
downloadmariadb-git-9a914a00227519859a69b1bad7f2add2fad7c870.tar.gz
BUG#6034 - Error code 124: Wrong medium type.
Version for 4.0. Committed for merge. If the result table is one of the select tables in INSERT SELECT, we must not disable the result tables indexes before selecting. mysql_execute_command() detects the match for other reasons and adds the flag OPTION_BUFFER_RESULT to the 'select_options'. In this case the result is put into a temporary table first. Hence, we can defer the preparation of the insert table until the result is to be used.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/insert_select.result12
-rw-r--r--mysql-test/t/insert_select.test15
2 files changed, 27 insertions, 0 deletions
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index ecd26f2d9fb..506f95f61bb 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -632,3 +632,15 @@ No Field Count
0 1 100
0 2 100
drop table t1, t2;
+CREATE TABLE t1 (
+ID int(11) NOT NULL auto_increment,
+NO int(11) NOT NULL default '0',
+SEQ int(11) NOT NULL default '0',
+PRIMARY KEY (ID),
+KEY t1$NO (SEQ,NO)
+) TYPE=MyISAM;
+INSERT INTO t1 (SEQ, NO) SELECT "1" AS SEQ, IF(MAX(NO) IS NULL, 0, MAX(NO)) + 1 AS NO FROM t1 WHERE (SEQ = 1);
+select SQL_BUFFER_RESULT * from t1 WHERE (SEQ = 1);
+ID NO SEQ
+1 1 1
+drop table t1;
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
index deb80dbcdbf..a54f8c4bfb5 100644
--- a/mysql-test/t/insert_select.test
+++ b/mysql-test/t/insert_select.test
@@ -176,3 +176,18 @@ insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2
select * from t2;
drop table t1, t2;
+
+#
+# BUG#6034 - Error code 124: Wrong medium type
+#
+CREATE TABLE t1 (
+ ID int(11) NOT NULL auto_increment,
+ NO int(11) NOT NULL default '0',
+ SEQ int(11) NOT NULL default '0',
+ PRIMARY KEY (ID),
+ KEY t1$NO (SEQ,NO)
+) TYPE=MyISAM;
+INSERT INTO t1 (SEQ, NO) SELECT "1" AS SEQ, IF(MAX(NO) IS NULL, 0, MAX(NO)) + 1 AS NO FROM t1 WHERE (SEQ = 1);
+select SQL_BUFFER_RESULT * from t1 WHERE (SEQ = 1);
+drop table t1;
+