11 messages in com.mysql.lists.mysqlI thought single UPDATE statements we...
FromSent OnAttachments
Mark Rages05 Jun 2003 16:52 
O'K Web Design05 Jun 2003 18:06 
Mark Rages05 Jun 2003 18:17 
Mark Matthews05 Jun 2003 18:44 
Paul DuBois05 Jun 2003 19:09 
Mark Rages05 Jun 2003 20:13 
Jon Haugsand06 Jun 2003 04:07 
Josh Smith06 Jun 2003 05:32 
Mark Rages06 Jun 2003 10:06 
Simpson, Ken06 Jun 2003 10:18 
Mark Matthews06 Jun 2003 10:54 
Subject:I thought single UPDATE statements were atomic
From:Mark Rages (mark@mlug.missouri.edu)
Date:06/05/2003 04:52:21 PM
List:com.mysql.lists.mysql

According to the docs, single update statements are atomic.

So why doesn't this work?

mysql> create table t (num INT, UNIQUE (num)); Query OK, 0 rows affected (0.00 sec)

mysql> insert into t values ('1'); Query OK, 1 row affected (0.00 sec)

mysql> insert into t values ('2'); Query OK, 1 row affected (0.00 sec)

mysql> select * from t; +------+ | num | +------+ | 1 | | 2 | +------+ 2 rows in set (0.00 sec)

mysql> update t set num=num+1; ERROR 1062: Duplicate entry '2' for key 1 mysql>

Help!