MySQL 错误 1136:列计数与第 1 行的值计数不匹配

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7557307/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 21:10:20  来源:igfitidea点击:

ERROR 1136: Column count doesn't match value count at row 1

mysql

提问by Javier Parra

I get the Error:

我收到错误:

Column count doesn't match value count at row 1.

But I've checked and rechecked my query and everything seems ok:

但我已经检查并重新检查了我的查询,一切似乎都没问题:

UPDATE
    table
SET
    col = 'enum(''FOO'',''BAR'')'
WHERE
    col1 = ''
AND
    col2 = 'val2'
AND
    col3 = 3;

I thought the table could have some triggers that were generating the error –I didn't design the system– but I can't find any.

我认为该表可能有一些触发器会产生错误——我没有设计系统——但我找不到任何触发器。

I've found the same error with at least three different tables.

我在至少三个不同的表中发现了相同的错误。

Note. The "enum" on line three is really supposed to be a string, not an enum type.

笔记。第三行的“enum”实际上应该是一个字符串,而不是一个枚举类型。

回答by Lucas

It could be a few things, but here are two ideas:

这可能是几件事,但这里有两个想法:

-There is a trigger that needs to be changed/removed.

- 有一个触发器需要更改/删除。

-The value that you are updating the cell to exceeds the column length. Article on this.

- 您要更新单元格的值超过列长度。关于这一点的文章。

回答by Javier Parra

Apparently there were some triggers that updated another database, I don't know why show triggers from <dbname>returned an empty row set.

显然有一些触发器更新了另一个数据库,我不知道为什么show triggers from <dbname>返回一个空行集。

Apparently, when migrating their system, they had to ask support to create the triggers for them.

显然,在迁移他们的系统时,他们必须寻求支持才能为他们创建触发器。

回答by nbhatti2001

Some time triggers create this issue as well. For example I have create a trigger to log the entries, when I add some field in master table and try to update the master table it display the same error. After some work around, I got the point and create the same field in log table and it fix the issue.

某些时间触发器也会产生此问题。例如,我创建了一个触发器来记录条目,当我在主表中添加一些字段并尝试更新主表时,它显示相同的错误。经过一些工作,我明白了并在日志表中创建了相同的字段并解决了问题。