2 messages in com.mysql.lists.bugsBugs with double update:| From | Sent On | Attachments |
|---|---|---|
| Peter Zaitsev | 28 Sep 2000 07:02 | |
| Michael Widenius | 28 Sep 2000 14:42 |
| Subject: | Bugs with double update:![]() |
|---|---|
| From: | Peter Zaitsev (pz...@spylog.ru) |
| Date: | 09/28/2000 07:02:00 AM |
| List: | com.mysql.lists.bugs |
The problem is MYSQL updates one row twice - LINUX mysql 3.23.22 I thought this problem with updates was fixed some time ago ?
CREATE TABLE StatByPlaceByDay ( place_id int (10) unsigned NOT NULL, shows int(10) unsigned DEFAULT '0' NOT NULL, ishows int(10) unsigned DEFAULT '0' NOT NULL, ushows int(10) unsigned DEFAULT '0' NOT NULL, clicks int(10) unsigned DEFAULT '0' NOT NULL, iclicks int(10) unsigned DEFAULT '0' NOT NULL, uclicks int(10) unsigned DEFAULT '0' NOT NULL, ts timestamp(14), PRIMARY KEY (place_id,ts) );
INSERT INTO StatByPlaceByDay (place_id,shows,ishows,ushows,clicks,iclicks,uclicks) VALUES (1,0,0,0,0,0,0); mysql> INSERT INTO StatByPlaceByDay (place_id,shows,ishows,ushows,clicks,iclicks,uclicks) VALUES (1,0,0,0,0,0,0);
Query OK, 1 row affected (0.00 sec)
mysql> select * from StatByPlaceByDay; +----------+-------+--------+--------+--------+---------+---------+--------- -------+ | place_id | shows | ishows | ushows | clicks | iclicks | uclicks | ts | +----------+-------+--------+--------+--------+---------+---------+--------- -------+ | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 20000928174434 | +----------+-------+--------+--------+--------+---------+---------+--------- -------+ 1 row in set (0.00 sec)
mysql> UPDATE StatByPlaceByDay SET shows=shows+1,ishows=ishows+1,ushows=ushows+1,clicks=clicks+1,iclicks=iclick s+1,uclicks=uclicks+1 WHERE place_id=1 AND ts>="2000-09-28 00:00:00" AND ts<="2000-09-28 23:59:59";
Query OK, 2 rows affected (0.03 sec) Rows matched: 2 Changed: 2 Warnings: 0
mysql> select * from StatByPlaceByDay; +----------+-------+--------+--------+--------+---------+---------+--------- -------+ | place_id | shows | ishows | ushows | clicks | iclicks | uclicks | ts | +----------+-------+--------+--------+--------+---------+---------+--------- -------+ | 1 | 2 | 2 | 2 | 2 | 2 | 2 | 20000928174917 | +----------+-------+--------+--------+--------+---------+---------+--------- -------+ 1 row in set (0.00 sec)




