Description:
I have a select query which causes
ERROR 2013: Lost connection to MySQL server during query
This doesn't cause mysql to fall over.
Any other query subsequently run is fine albeit with a
ERROR 2006: MySQL server has gone away
No connection. Trying to reconnect...
reported before the query results.
Yet when one dummy record is put in the queried table the same select query runs without fault.
$ mysql -V
mysql Ver 11.16 Distrib 3.23.49, for unknown-linux-gnu (alphaev6)
How to repeat:
Below is mysql output demonstrating this.
At the end of this I have included the
show create table
and table description.
mysql> select * from answers;
Empty set (0.01 sec)
mysql> select * from questionnaires;
+--------------+-----------+-----------+------------+---------------------+
| instrumentId | subjectId | studyWeek | pageId | dtInsert |
+--------------+-----------+-----------+------------+---------------------+
| DR | ADV-90099 | 1 | 1093530708 | 2004-08-26 15:31:58 |
| GAS | ADV-90099 | 1 | 1093530686 | 2004-08-26 15:31:36 |
+--------------+-----------+-----------+------------+---------------------+
2 rows in set (0.00 sec)
mysql> select * from answers where instrumentId = 'DR' and subjectId = 'ADV-90099' and studyWeek = 1 and pageId = 1093530727;
ERROR 2013: Lost connection to MySQL server during query
mysql> select * from questionnaires;
ERROR 2006: MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 1
Current database: gendep
+--------------+-----------+-----------+------------+---------------------+
| instrumentId | subjectId | studyWeek | pageId | dtInsert |
+--------------+-----------+-----------+------------+---------------------+
| DR | ADV-90099 | 1 | 1093530708 | 2004-08-26 15:31:58 |
| GAS | ADV-90099 | 1 | 1093530686 | 2004-08-26 15:31:36 |
+--------------+-----------+-----------+------------+---------------------+
2 rows in set (0.19 sec)
mysql> select * from answers;
Empty set (0.01 sec)
mysql> insert into answers (questionId, instrumentId, subjectId) values('dummy', 'dummy', 'dummy' );
Query OK, 1 row affected (0.04 sec)
mysql> select * from answers;
+--------+------------+--------------+-----------+-----------+------------+--------+---------+------------+
| pageId | questionId | instrumentId | subjectId | studyWeek | unanswered | answer | inputer | whenInput |
+--------+------------+--------------+-----------+-----------+------------+--------+---------+------------+
| 0 | dummy | dummy | dummy | 0 | True | | | 0000-00-00 |
+--------+------------+--------------+-----------+-----------+------------+--------+---------+------------+
1 row in set (0.00 sec)
mysql> select * from answers where instrumentId = 'DR' and subjectId = 'ADV-90099' and studyWeek = 1 and pageId = 1093530727;
Empty set (0.06 sec)
mysql> select * from questionnaires;
+--------------+-----------+-----------+------------+---------------------+
| instrumentId | subjectId | studyWeek | pageId | dtInsert |
+--------------+-----------+-----------+------------+---------------------+
| DR | ADV-90099 | 1 | 1093530708 | 2004-08-26 15:31:58 |
| GAS | ADV-90099 | 1 | 1093530686 | 2004-08-26 15:31:36 |
+--------------+-----------+-----------+------------+---------------------+
2 rows in set (0.00 sec)
mysql> show create table answers;
+---------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+---------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| answers | CREATE TABLE `answers` (
`pageId` bigint(20) NOT NULL default '0',
`questionId` varchar(20) NOT NULL default '',
`instrumentId` varchar(10) NOT NULL default '',
`subjectId` varchar(9) NOT NULL default '',
`studyWeek` int(11) NOT NULL default '0',
`unanswered` enum('True','False') NOT NULL default 'True',
`answer` varchar(20) NOT NULL default '',
`inputer` varchar(50) NOT NULL default '',
`whenInput` date NOT NULL default '0000-00-00',
PRIMARY KEY (`pageId`,`questionId`,`instrumentId`,`subjectId`,`studyWeek`)
) TYPE=BerkeleyDB |
+---------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.03 sec)
mysql>
mysql> desc answers;
+--------------+----------------------+------+-----+------------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+----------------------+------+-----+------------+-------+
| pageId | bigint(20) | | PRI | 0 | |
| questionId | varchar(20) | | PRI | | |
| instrumentId | varchar(10) | | PRI | | |
| subjectId | varchar(9) | | PRI | | |
| studyWeek | int(11) | | PRI | 0 | |
| unanswered | enum('True','False') | | | True | |
| answer | varchar(20) | | | | |
| inputer | varchar(50) | | | | |
| whenInput | date | | | 0000-00-00 | |
+--------------+----------------------+------+-----+------------+-------+
9 rows in set (0.00 sec)
This is the command I actually used to create the table:-
CREATE TABLE answers (pageId BIGINT NOT NULL, questionId VARCHAR(20) NOT NULL, instrumentId VARCHAR(10) NOT NULL, subjectId CHAR(9) NOT NULL, studyWeek INT NOT NULL, unanswered ENUM( 'True', 'False' ) NOT NULL, answer VARCHAR(20) NOT NULL, inputer VARCHAR(50) NOT NULL, whenInput DATE NOT NULL, PRIMARY KEY ( pageId, questionId, instrumentId, subjectId, studyWeek ) ) TYPE=BDB;