summaryrefslogtreecommitdiffstats
path: root/mysql-test/main/create_select_tmp.test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:07:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:07:14 +0000
commita175314c3e5827eb193872241446f2f8f5c9d33c (patch)
treecd3d60ca99ae00829c52a6ca79150a5b6e62528b /mysql-test/main/create_select_tmp.test
parentInitial commit. (diff)
downloadmariadb-10.5-a175314c3e5827eb193872241446f2f8f5c9d33c.tar.xz
mariadb-10.5-a175314c3e5827eb193872241446f2f8f5c9d33c.zip
Adding upstream version 1:10.5.12.upstream/1%10.5.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/main/create_select_tmp.test')
-rw-r--r--mysql-test/main/create_select_tmp.test53
1 files changed, 53 insertions, 0 deletions
diff --git a/mysql-test/main/create_select_tmp.test b/mysql-test/main/create_select_tmp.test
new file mode 100644
index 00000000..3ed885ea
--- /dev/null
+++ b/mysql-test/main/create_select_tmp.test
@@ -0,0 +1,53 @@
+# Testcase for BUG#4551
+# The bug was that when the table was TEMPORARY, it was not deleted if
+# the CREATE SELECT failed (the code intended too, but it actually
+# didn't). And as the CREATE TEMPORARY TABLE was not written to the
+# binlog if it was a transactional table, it resulted in an
+# inconsistency between binlog and the internal list of temp tables.
+
+# This does not work for RBR yet.
+--source include/have_binlog_format_mixed_or_statement.inc
+
+--disable_query_log
+CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+--enable_query_log
+
+-- source include/have_innodb.inc
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+CREATE TABLE t1 ( a int );
+INSERT INTO t1 VALUES (1),(2),(1);
+--error ER_DUP_ENTRY
+CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
+--error 1146
+select * from t2;
+--error ER_DUP_ENTRY
+CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
+--error 1146
+select * from t2;
+--error ER_DUP_ENTRY
+CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
+--error 1146
+select * from t2;
+--error ER_DUP_ENTRY
+CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
+--error 1146
+select * from t2;
+drop table t1;
+
+# End of 4.1 tests
+
+set sql_mode='ignore_bad_table_options';
+create table t1 (
+ f1 int invisible,
+ f2 int comment 'a comment',
+ f3 int foo="bar",
+ f4 int check(f4 < 10),
+ f5 int without system versioning
+) with system versioning as select 1 as f1,2 as f2,3 as f3,4 as f4,5 as f5;
+show create table t1;
+drop table t1;
+set sql_mode=default;
+
+# End of 10.4 tests