Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.11, 11.4, 11.6
-
None
Description
> CREATE TABLE b (`transaction_id` int(11) NOT NULL DEFAULT '0', KEY `transaction_id` (`transaction_id`));
|
Query OK, 0 rows affected (0.01 sec)
|
|
> alter table b DROP KEY transaction_id, ADD UNIQUE KEY IF NOT EXISTS (transaction_id);
|
Query OK, 0 rows affected, 1 warning (0.00 sec)
|
Records: 0 Duplicates: 0 Warnings: 1
|
|
> show create table b;
|
+-------+-----------------------------------------------------------------------------------------------------------+
|
| Table | Create Table |
|
+-------+-----------------------------------------------------------------------------------------------------------+
|
| b | CREATE TABLE `b` (
|
`transaction_id` int(11) NOT NULL DEFAULT '0'
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
|
+-------+-----------------------------------------------------------------------------------------------------------+
|
expected results: A table with a unique key.
holyfoot says in MDEV-8212 that the IF EXISTS applies to what is there BEFORE the query. This is obviously how its implemented. What the expected behaviour reading the SQL statement?
Attachments
Issue Links
- is duplicated by
-
MDEV-21176 DROP INDEX IF EXISTS and ADD INDEX IF NOT EXISTS in the same transaction doesn't work
- Closed
- relates to
-
MDEV-8212 alter table - failing to ADD PRIMARY KEY IF NOT EXISTS when existing index of same as column name
- Closed