当我尝试执行列数匹配的查询时,MySQL 发出此错误。这是表的结构:
mysql> desc S_3068;
+-------------------+----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+----------------------+------+-----+---------+-------+
| SfmID | smallint(5) unsigned | NO | PRI | 1 | |
| DatValue | float | NO | | 0 | |
| DatRawValue | int(10) unsigned | NO | | 0 | |
| DatTime | int(10) unsigned | NO | PRI | 0 | |
| DatBusOrder | tinyint(3) unsigned | NO | PRI | 1 | |
| DatFormulaVersion | tinyint(3) unsigned | NO | | 0 | |
+-------------------+----------------------+------+-----+---------+-------+
6 rows in set (0.00 sec)
执行此查询时出现上述错误:
mysql> insert ignore into S_3068 values (133, 15.82, 5542, 1339309260, 0, 1);
ERROR 1136 (21S01): Column count doesn't match value count at row 1
如您所见,列计数确实与值计数匹配。现在更令人费解的是,查询在 SfmID = 132 时工作得非常好:
mysql> insert ignore into S_3068 values (132, 15.82, 5542, 1339309260, 0, 1);
Query OK, 1 row affected (0.00 sec)
SfmID 是一个无符号的 smallint,这对我来说没有任何意义。
对此问题的任何帮助将不胜感激。
编辑:错误是由与表关联的触发器引起的。请参阅评论以获取更多信息。