You can't, iirc - if you add an autoincrement to InnoDB it MUST be the primary key.
You *can*, however, add that, set it as PK and stick a unique index on (cluster, file) instead. Behaviour will be identical, but be aware that there will be some performance implications - you will now have to do an extra primary key lookup every time you select based on the (cluster,file) key. On Thu, Apr 22, 2010 at 7:03 AM, Aveek Misra <ave...@yahoo-inc.com> wrote: > I have a InnoDB table which contains columns named 'cluster' and 'file' > ('cluster' + 'file' is a primary key). I want to add a new column that > tracks the revision number of a file for a given cluster and a file. The > situation is tailor made for a MyIsam table where I can add a new Auto > Increment column as a secondary column in a multiple column index. How can I > get the same behavior in an InnoDB table? Given below is a view of how the > records will look like > > -------------------------------------------------------- > | Cluster | File | Rev | > -------------------------------------------------------- > | clusterA | fileA | 1 | > -------------------------------------------------------- > | clusterA | fileA | 2 | > --------------------------------------------------------- > | clusterB | fileA | 1 | > -------------------------------------------------------- > | clusterB | fileB | 1 | > -------------------------------------------------------- > > > > Thanks > Aveek > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql?unsub=vegiv...@tuxera.be > > -- Bier met grenadyn Is als mosterd by den wyn Sy die't drinkt, is eene kwezel Hy die't drinkt, is ras een ezel