[MDEV-21889] IF EXISTS clause does not work for RENAME COLUMN and RENAME INDEX Created: 2020-03-07  Updated: 2020-04-04  Resolved: 2020-04-04

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table
Affects Version/s: 10.5
Fix Version/s: 10.5.3

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Aleksey Midenkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-7318 RENAME INDEX Closed
relates to MDEV-16290 ALTER TABLE ... RENAME COLUMN syntax Closed

 Description   

In MDEV-16290, ALTER TABLE .. RENAME COLUMN was implemented. I think it should follow standard conventions and support IF EXISTS clause, as other column operations do:

10.5 a4ab54d7

MariaDB [test]> create table t (a int);
Query OK, 0 rows affected (0.214 sec)
 
MariaDB [test]> alter table t change column if exists a b int;
Query OK, 0 rows affected (0.044 sec)
Records: 0  Duplicates: 0  Warnings: 0
 
MariaDB [test]> alter table t modify column if exists b char(8);
Query OK, 0 rows affected (0.292 sec)              
Records: 0  Duplicates: 0  Warnings: 0
 
MariaDB [test]> alter table t add column if not exists a int;
Query OK, 0 rows affected (0.040 sec)
Records: 0  Duplicates: 0  Warnings: 0
 
MariaDB [test]> alter table t drop column if exists a;
Query OK, 0 rows affected (0.089 sec)
Records: 0  Duplicates: 0  Warnings: 0

MariaDB [test]> alter table t rename column if exists b to c;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'if exists b to c' at line 1

Same for RENAME INDEX implemented in MDEV-7318.



 Comments   
Comment by Oleksandr Byelkin [ 2020-03-11 ]

OK to push

Generated at Thu Feb 08 09:10:37 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.