Bug #61942 Mysql command to modify the unique index of a table
Submitted: 21 Jul 2011 12:53 Modified: 21 Jul 2011 14:51
Reporter: uday kumar rajarapu Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: DML Severity:S5 (Performance)
Version:mysql 5.5 OS:Linux
Assigned to: CPU Architecture:Any
Tags: addind a column as a unique index to existing one's

[21 Jul 2011 12:53] uday kumar rajarapu
Description:
HI,

I need to add a column as a unique index to the existing unique index columns for a table.Please provide me the solution other than droping the existing unique index and create the unique new unique index with required number of columns.

Thanks & Regards
udaykumar,DBA,
uday1802@gmail.com

How to repeat:
How to handle this bug.

Suggested fix:
Provide solution  other than the below process to include a column as unique index.Here i want to add a column orgid as unique index to the existing unique index columns  ATMASTGRP,ATMCODE,ATMVPMSIZE.

#######droping the index

  alter table ismatm drop index idx_ismatm ;

########Creating  the unique index including the column orgid

  create unique index idx_ismatm on ismatm(ATMASTGRP,ATMCODE,ATMVPMSIZE,ORGID);
[21 Jul 2011 14:51] Valeriy Kravchuk
You can try to do it with one ALTER TABLE:

alter table ismatm drop index idx_ismatm, add unique index idx_ismatm on ismatm(ATMASTGRP,ATMCODE,ATMVPMSIZE,ORGID);

There is no other solution. See http://dev.mysql.com/doc/refman/5.5/en/alter-table.html.