[MDEV-14694] ALTER COLUMN IF EXISTS .. causes syntax error Created: 2017-12-17  Updated: 2018-01-30  Resolved: 2018-01-30

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table
Affects Version/s: 10.0, 10.1, 10.2
Fix Version/s: 10.3.5

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Alexey Botchkov
Resolution: Fixed Votes: 0
Labels: None

Sprint: 10.1.31

 Description   

In the scope of MDEV-318, ALTER TABLE was extended to allow IF [NOT] EXISTS clauses, including those for MODIFY COLUMN and CHANGE COLUMN. However, ALTER COLUMN does not accept it:

MariaDB [test]> create table t1 (i int);
Query OK, 0 rows affected (0.26 sec)
 
MariaDB [test]> alter table t1 change column if exists a b int;
Query OK, 0 rows affected, 1 warning (0.00 sec)
Records: 0  Duplicates: 0  Warnings: 1
 
MariaDB [test]> alter table t1 alter column if exists a set default 1;
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 a set default 1' at line 1
MariaDB [test]> select @@version;
+-----------------------+
| @@version             |
+-----------------------+
| 10.0.34-MariaDB-debug |
+-----------------------+
1 row in set (0.00 sec)

The task doesn't say anything about it being left out intentionally, so I suppose it's an omission.



 Comments   
Comment by Alexey Botchkov [ 2018-01-30 ]

http://lists.askmonty.org/pipermail/commits/2018-January/011926.html

Generated at Thu Feb 08 08:15:33 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.