Re: MySql bug?
Indrek Siitan <[email protected]>
| Newsgroups | gmane.comp.db.mysql.bugs |
|---|---|
| Message-ID | <BB8DF480.30201%[email protected]> |
Hi, > In MySql I create this table: > > CREATE TABLE `prova` ( > `Gruppo` int(11) NOT NULL default '0', > `Prog` int(11) NOT NULL default '0', > `Descrizione` varchar(100) default '', > PRIMARY KEY (`Gruppo`, `Prog`) > ) TYPE=MyISAM; > > Running this: > UPDATE Prog SET Prog=Prog+1 WHERE Gruppo=16 AND Prog>=1 > > I get "Duplicate entry". > > Is this a MySql bug? How can I do this? This is not a bug, but a shortcoming of MyISAM tables not being transactional. But you can overcome this by using the following query: UPDATE Prog SET Prog=Prog+1 WHERE Gruppo=16 AND Prog>=1 ORDER BY Prog DESC; Rgds, Indrek -- | Indrek Siitan, MySQL AB, Support Engineer & Bugmaster | Uuemõisa, Haapsalu, Estonia +- | Are you MySQL Certified? http://www.mysql.com/certification/ -- -- MySQL Bugs Mailing List For list archives: http://lists.mysql.com/bugs To unsubscribe: http://lists.mysql.com/[email protected]