Description:
When you add some records with connection let say test_con1 and then switch to another connection and then add some more records, and after that switch to first connection and commit, the records do not get saved in table that you have inserted in test_con1.
How to repeat:
CREATE TABLE t1
(
id INT NOT NULL auto_increment,
PRIMARY KEY (id),
name varchar(30)
) ENGINE = INNODB;
## Creating new connection ##
CONNECT (test_con1,localhost,root,,);
CONNECTION test_con1;
## Setting value of variable to zero and inserting some rows ##
SET @@autocommit = 0;
INSERT into t1(name) values('Record_1');
INSERT into t1(name) values('Record_2');
SELECT * from t1;
id name
1 Record_1
2 Record_2
## Creating another connection and verifying records in table ##
## New Connection test_con2 ##
CONNECT (test_con2,localhost,root,,);
CONNECTION test_con2;
SELECT * from t1;
id name
## Verifying behavior of variable by commiting rows in test_con1 ##
## Connecting with connection # 01 ##
connection test_con1;
SELECT * from t1;
id name
1 Record_1
2 Record_2
COMMIT;
## Now verifying records in table from connection # 02 ##
CONNECTION test_con2;
SELECT * from t1;
id name
1 Record_1
2 Record_2
## Connecting with connection # 01 ##
connection test_con1;
INSERT into t1(name) values('Record_3');
## Connection test_con2 ##
connection test_con2;
## Now verifying records in table from connection # 02 and changing value ##
## of autocommit to true ##
SELECT * from t1;
id name
1 Record_1
2 Record_2
SET @@autocommit = 1;
INSERT into t1(name) values('Record_4');
INSERT into t1(name) values('Record_5');
SELECT * from t1;
id name
1 Record_1
2 Record_2
4 Record_4
5 Record_5
## Connecting with connection # 01 and inserting few records ##
connection test_con1;
SELECT * from t1;
id name
1 Record_1
2 Record_2
3 Record_3
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
## Bug: Here Record_4 & Record_5 should be in table ##
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
INSERT into t1(name) values('Record_6');
SELECT * from t1;
id name
1 Record_1
2 Record_2
3 Record_3
6 Record_6
Description: When you add some records with connection let say test_con1 and then switch to another connection and then add some more records, and after that switch to first connection and commit, the records do not get saved in table that you have inserted in test_con1. How to repeat: CREATE TABLE t1 ( id INT NOT NULL auto_increment, PRIMARY KEY (id), name varchar(30) ) ENGINE = INNODB; ## Creating new connection ## CONNECT (test_con1,localhost,root,,); CONNECTION test_con1; ## Setting value of variable to zero and inserting some rows ## SET @@autocommit = 0; INSERT into t1(name) values('Record_1'); INSERT into t1(name) values('Record_2'); SELECT * from t1; id name 1 Record_1 2 Record_2 ## Creating another connection and verifying records in table ## ## New Connection test_con2 ## CONNECT (test_con2,localhost,root,,); CONNECTION test_con2; SELECT * from t1; id name ## Verifying behavior of variable by commiting rows in test_con1 ## ## Connecting with connection # 01 ## connection test_con1; SELECT * from t1; id name 1 Record_1 2 Record_2 COMMIT; ## Now verifying records in table from connection # 02 ## CONNECTION test_con2; SELECT * from t1; id name 1 Record_1 2 Record_2 ## Connecting with connection # 01 ## connection test_con1; INSERT into t1(name) values('Record_3'); ## Connection test_con2 ## connection test_con2; ## Now verifying records in table from connection # 02 and changing value ## ## of autocommit to true ## SELECT * from t1; id name 1 Record_1 2 Record_2 SET @@autocommit = 1; INSERT into t1(name) values('Record_4'); INSERT into t1(name) values('Record_5'); SELECT * from t1; id name 1 Record_1 2 Record_2 4 Record_4 5 Record_5 ## Connecting with connection # 01 and inserting few records ## connection test_con1; SELECT * from t1; id name 1 Record_1 2 Record_2 3 Record_3 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ ## Bug: Here Record_4 & Record_5 should be in table ## +++++++++++++++++++++++++++++++++++++++++++++++++++++++ INSERT into t1(name) values('Record_6'); SELECT * from t1; id name 1 Record_1 2 Record_2 3 Record_3 6 Record_6