Ticket #26347: django_m2m_bug_step_by_step

File django_m2m_bug_step_by_step, 1.2 KB (added by Hugo Chargois, 9 years ago)
Line 
1Setup
2======
3
4CREATE TABLE t ( id INT NOT NULL AUTO_INCREMENT, from_id INT, to_id INT, PRIMARY KEY (id) );
5INSERT INTO t (from_id, to_id) VALUES (10, 20);
6
7Session A Session B
8========= =========
9
10SET autocommit=0; SET autocommit=0;
11
12SELECT * FROM t; SELECT * FROM t;
13+----+---------+-------+ +----+---------+-------+
14| id | from_id | to_id | | id | from_id | to_id |
15+----+---------+-------+ +----+---------+-------+
16| 1 | 10 | 20 | | 1 | 10 | 20 |
17+----+---------+-------+ +----+---------+-------+
181 row in set 1 row in set
19
20DELETE FROM t WHERE from_id=10;
21Query OK, 1 row affected
22
23SELECT * FROM t WHERE from_id=10 and to_id IN (20);
24Empty set
25
26INSERT INTO t (from_id, to_id) VALUES (10, 20);
27Query OK, 1 row affected
28
29COMMIT;
30SET autocommit=1;
31
32 DELETE FROM t WHERE from_id=10;
33 Query OK, 1 row affected
34
35 SELECT * FROM t WHERE from_id=10 and to_id IN (20);
36 +----+---------+-------+
37 | id | from_id | to_id |
38 +----+---------+-------+
39 | 1 | 10 | 20 |
40 +----+---------+-------+
41 1 row in set
42
43 (Not inserting anything since "it's already there!")
44
45 COMMIT;
46 SET autocommit=1;
47
48Later
49=====
50
51SELECT * FROM t;
52Empty set
Back to Top