summaryrefslogtreecommitdiff
path: root/mysql-test/main
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2020-04-04 00:53:36 +0300
committerAleksey Midenkov <midenok@gmail.com>2020-04-04 00:53:36 +0300
commit431a740815dc21d7daf00359b1764c41ff95bbdc (patch)
tree461222361b1fa92b9b26b114127e522c3ec7aa56 /mysql-test/main
parent6fb3e83d74a56478532b592e36d8082d2de61f3b (diff)
downloadmariadb-git-431a740815dc21d7daf00359b1764c41ff95bbdc.tar.gz
MDEV-21889 IF EXISTS clause does not work for RENAME COLUMN and RENAME INDEX
Diffstat (limited to 'mysql-test/main')
-rw-r--r--mysql-test/main/alter_table.result8
-rw-r--r--mysql-test/main/alter_table.test4
2 files changed, 12 insertions, 0 deletions
diff --git a/mysql-test/main/alter_table.result b/mysql-test/main/alter_table.result
index 36fb35f05b4..b012fdde54b 100644
--- a/mysql-test/main/alter_table.result
+++ b/mysql-test/main/alter_table.result
@@ -2594,6 +2594,11 @@ t1 CREATE TABLE `t1` (
`c` float DEFAULT NULL
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1
ALTER TABLE t1 RENAME COLUMN a TO m;
+ALTER TABLE t1 RENAME COLUMN a TO m;
+ERROR 42S22: Unknown column 'a' in 't1'
+ALTER TABLE t1 RENAME COLUMN IF EXISTS a TO m;
+Warnings:
+Note 1054 Unknown column 'a' in 't1'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -2882,6 +2887,9 @@ t1 CREATE TABLE `t1` (
# exists, dropped or added within the same ALTER TABLE.
alter table t1 rename key d to e;
ERROR 42000: Key 'd' doesn't exist in table 't1'
+alter table t1 rename key if exists d to e;
+Warnings:
+Note 1176 Key 'd' doesn't exist in table 't1'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/main/alter_table.test b/mysql-test/main/alter_table.test
index 9ee42a1ca98..01ab0f99d45 100644
--- a/mysql-test/main/alter_table.test
+++ b/mysql-test/main/alter_table.test
@@ -2110,6 +2110,9 @@ ALTER TABLE t1 RENAME COLUMN a TO a;
--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" ""
SHOW CREATE TABLE t1;
ALTER TABLE t1 RENAME COLUMN a TO m;
+--error ER_BAD_FIELD_ERROR
+ALTER TABLE t1 RENAME COLUMN a TO m;
+ALTER TABLE t1 RENAME COLUMN IF EXISTS a TO m;
--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" ""
SHOW CREATE TABLE t1;
SELECT * FROM t1;
@@ -2293,6 +2296,7 @@ show create table t1;
--echo # exists, dropped or added within the same ALTER TABLE.
--error ER_KEY_DOES_NOT_EXISTS
alter table t1 rename key d to e;
+alter table t1 rename key if exists d to e;
show create table t1;
--error ER_KEY_DOES_NOT_EXISTS
alter table t1 drop key c, rename key c to d;