Details
- 
    
Bug
 - 
    Status: Closed (View Workflow)
 - 
    
Minor
 - 
    Resolution: Fixed
 - 
    10.0.2
 - 
    None
 - 
    None
 
Description
Test case:
					create table t1 (i int);  | 
		
					alter table t1 add unique index if not exists idx(i);  | 
		
Output:
					MariaDB [test]> create table t1 (i int);  | 
		
					Query OK, 0 rows affected (0.32 sec)  | 
		
| 
					 | 
		
					MariaDB [test]> alter table t1 add unique index if not exists idx(i);  | 
		
					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 not exists idx(i)' at line 1  | 
		
Apparently this variation somehow slipped from the syntax changes. This one works:
					MariaDB [test]> create unique index if not exists idx2 on t1 (i);  | 
		
					Query OK, 0 rows affected (0.42 sec)  | 
		
					Records: 0  Duplicates: 0  Warnings: 0
			 | 
		
This of course works too:
					MariaDB [test]> alter table t1 add unique index idx1(i);  | 
		
					Query OK, 0 rows affected (0.33 sec)  | 
		
					Records: 0  Duplicates: 0  Warnings: 0
			 | 
		
And other modifiers work (with corresponding data types):
					MariaDB [test]> alter table t2 add fulltext index if not exists idx(b);  | 
		
					Query OK, 0 rows affected (0.23 sec)  | 
		
					Records: 0  Duplicates: 0  Warnings: 0
			 | 
		
| 
					 | 
		
					MariaDB [test]> alter table t2 add spatial index if not exists idx2(a);  | 
		
					Query OK, 0 rows affected (0.19 sec)  | 
		
					Records: 0  Duplicates: 0  Warnings: 0
			 | 
		
					revision-id: bar@mariadb.org-20130424142022-u4xhikvoqggze9b0
			 | 
		
					revno: 3745
			 | 
		
					branch-nick: 10.0
			 | 
		
Attachments
Issue Links
- relates to
 - 
                    
MDEV-318 IF (NOT) EXIST clauses for ALTER TABLE (MWL #252)
-         
 - Closed
 
 -