summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-12-08 12:33:33 -0800
committerunknown <jimw@mysql.com>2005-12-08 12:33:33 -0800
commit3b0c9e459fdaf26e6fd290ff0a5f586dd005fa84 (patch)
tree17c25f1452a24b4c5142a7cd6aa2a37e7558efcf /mysql-test
parent30b95ec01a80b12f284d9300c5666a2686eb3b7d (diff)
downloadmariadb-git-3b0c9e459fdaf26e6fd290ff0a5f586dd005fa84.tar.gz
Fix calls to free_underlaid_joins() in INSERT, DELETE, and UPDATE
handling so that indexes are closed before trying to commit the transaction. (Bug #15536) mysql-test/r/bdb.result: Add new results mysql-test/t/bdb.test: Add new test sql/sql_delete.cc: Move call to free_underlaid_joins() to before ha_autocommit_or_rollback(). sql/sql_insert.cc: Move call to free_underlaid_joins() to before ha_autocommit_or_rollback(). sql/sql_update.cc: Move call to free_underlaid_joins() to before ha_autocommit_or_rollback().
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/bdb.result19
-rw-r--r--mysql-test/t/bdb.test20
2 files changed, 38 insertions, 1 deletions
diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result
index 6da3dbb929d..9fb42a0f6fd 100644
--- a/mysql-test/r/bdb.result
+++ b/mysql-test/r/bdb.result
@@ -1284,3 +1284,22 @@ SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
id
4
DROP TABLE t1;
+create table t1 (a int, key(a)) engine=bdb;
+create table t2 (b int, key(b)) engine=bdb;
+insert into t1 values (1),(1),(2),(3),(4);
+insert into t2 values (1),(5),(6),(7);
+delete from t1 where (a in (select b from t2));
+select count(*) from t1;
+count(*)
+3
+insert into t1 set a=(select b from t2);
+ERROR 21000: Subquery returns more than 1 row
+select count(*) from t1;
+count(*)
+3
+update t1 set a = a + 1 where (a in (select b from t2));
+select count(*) from t1;
+count(*)
+3
+drop table t1, t2;
+End of 4.1 tests
diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test
index 6ceb0ea0789..de9709b97ad 100644
--- a/mysql-test/t/bdb.test
+++ b/mysql-test/t/bdb.test
@@ -930,4 +930,22 @@ SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera");
SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
DROP TABLE t1;
-# End of 4.1 tests
+#
+# Bug #15536: Crash when DELETE with subquery using BDB tables
+#
+create table t1 (a int, key(a)) engine=bdb;
+create table t2 (b int, key(b)) engine=bdb;
+insert into t1 values (1),(1),(2),(3),(4);
+insert into t2 values (1),(5),(6),(7);
+delete from t1 where (a in (select b from t2));
+select count(*) from t1;
+# INSERT also blows up
+--error 1242
+insert into t1 set a=(select b from t2);
+select count(*) from t1;
+# UPDATE also blows up
+update t1 set a = a + 1 where (a in (select b from t2));
+select count(*) from t1;
+drop table t1, t2;
+
+--echo End of 4.1 tests