summaryrefslogtreecommitdiff
path: root/mysql-test/main/rename.test
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2019-12-30 13:34:28 +0200
committerMonty <monty@mariadb.org>2020-03-24 20:47:41 +0200
commitbff79492c5f6c9669b9dc9bf2cf0483b3b001da7 (patch)
tree7d13874ae2bf8a8c2caba079f1010d401d65dcaf /mysql-test/main/rename.test
parent5f5c63e0fe6eac590549bdb76204a07cb2fe2aa1 (diff)
downloadmariadb-git-bff79492c5f6c9669b9dc9bf2cf0483b3b001da7.tar.gz
Added IF EXISTS to RENAME TABLE and ALTER TABLE
Diffstat (limited to 'mysql-test/main/rename.test')
-rw-r--r--mysql-test/main/rename.test18
1 files changed, 18 insertions, 0 deletions
diff --git a/mysql-test/main/rename.test b/mysql-test/main/rename.test
index 215ecbcbb18..a0b9f38ae2e 100644
--- a/mysql-test/main/rename.test
+++ b/mysql-test/main/rename.test
@@ -148,3 +148,21 @@ create table t1 (a int) engine=memory;
--error ER_BAD_DB_ERROR
rename table t1 to non_existent.t2;
drop table t1;
+
+--echo #
+--echo # Test rename IF EXISTS
+--echo #
+rename table if exists t1 to t2;
+alter table if exists t1 rename to t2;
+create table t2 (a int);
+alter table if exists t1 rename to t2;
+rename table if exists t1 to t2;
+create table t1 (a int);
+--error ER_TABLE_EXISTS_ERROR
+rename table if exists t1 to t2;
+--error ER_TABLE_EXISTS_ERROR
+alter table if exists t1 rename to t2;
+drop table t2;
+rename table if exists t1 to t2;
+alter table if exists t2 rename to t1;
+drop table t1;