summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <ingo@mysql.com>2005-01-19 21:13:30 +0100
committerunknown <ingo@mysql.com>2005-01-19 21:13:30 +0100
commit353bc07096fae7fd74cb315e445bc4b253cea5b5 (patch)
tree886cb12b82ab9e15cffe0dd94d20966003927f66 /mysql-test
parent7f4bb64a75224dd471d121c1ac6d3a4dc1cbb0b2 (diff)
downloadmariadb-git-353bc07096fae7fd74cb315e445bc4b253cea5b5.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. mysql-test/r/insert_select.result: BUG#6034 - Error code 124: Wrong medium type. The test results. mysql-test/t/insert_select.test: BUG#6034 - Error code 124: Wrong medium type. The test case. sql/sql_select.cc: BUG#6034 - Error code 124: Wrong medium type. With OPTION_BUFFER_RESULT in the 'select_options', defer the preparation of the insert table until the result is to be used. Unfortunately, this happens at several places.
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;
+