summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorJon Olav Hauglid <jon.hauglid@oracle.com>2010-08-20 09:16:26 +0200
committerJon Olav Hauglid <jon.hauglid@oracle.com>2010-08-20 09:16:26 +0200
commitbbaae9a2dceacecdd23aba6b7bb686d6248ae7c1 (patch)
tree2b9066fb804a7093f9edd2994db21bdae8269b3d /mysql-test/t
parent41caa7f4835bbcf45e4cdc6f5f0b17f1c8b088a2 (diff)
downloadmariadb-git-bbaae9a2dceacecdd23aba6b7bb686d6248ae7c1.tar.gz
Bug #55973 Assertion `thd->transaction.stmt.is_empty()'
on CREATE TABLE .. SELECT I_S.PART This assert was triggered if an InnoDB table was created using CREATE TABLE ... AS SELECT where the query used an I_S table, and a view existed in the database. It would also be triggered for any statement changing an InnoDB table (e.g. INSERT, UPDATE, DELETE) which had a subquery referencing an I_S table. The assert was triggered if open_normal_and_derived_tables() failed and a statement transaction had been started. This will usually not happen as tables are opened before a statement transaction is started. However, e.g. CREATE TABLE ... AS SELECT starts a transaction in order to insert tuples into the new table. And if the subquery references an I_S table, all current tables and views can be opened in order to fill the I_S table on the fly. If a view is discovered, open will fail as it is instructed to open tables only (OPEN_TABLE_ONLY). This would cause the assert to be triggered. The assert was added in the patch for Bug#52044 and was therefore not in any released versions of the server. This patch fixes the problem by adjusting the assert to take into consideration the possibility of tables being opened as part of an I_S query. This is similar to what is already done for close_tables_for_reopen(). Test case added to information_schema_inno.test.
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/information_schema_inno.test20
1 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/t/information_schema_inno.test b/mysql-test/t/information_schema_inno.test
index 1a537d740b7..657d0effd7e 100644
--- a/mysql-test/t/information_schema_inno.test
+++ b/mysql-test/t/information_schema_inno.test
@@ -89,3 +89,23 @@ from information_schema.referential_constraints
where constraint_schema = schema();
drop table t2;
set foreign_key_checks = 1;
+
+
+--echo #
+--echo # Bug#55973 Assertion `thd->transaction.stmt.is_empty()'
+--echo # on CREATE TABLE .. SELECT I_S.PART
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+
+CREATE VIEW v1 AS SELECT 1;
+# This used to case an assert.
+CREATE TABLE t1 engine = InnoDB AS
+ SELECT * FROM information_schema.partitions
+ WHERE table_schema= 'test' AND table_name= 'v1';
+
+DROP TABLE t1;
+DROP VIEW v1;