mysql-“列不能为空" [英] mysql - "column cannot be null"

查看:165
本文介绍了mysql-“列不能为空"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所示,即使我从相关字段中删除了"not null"功能,尽管该字段是可空的,但它仍然不允许我为该字段插入null值!

as you see in the title, even if i removed "not null" feature from the related field, it still doesn't let me to insert null value for that field although the field is nullable!

任何帮助将不胜感激.

已编辑

CREATE TABLE `review` (
..
`RATING` int(11) DEFAULT NULL,
..
(`CATALOG_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=31625 DEFAULT CHARSET=latin5 ROW_FORMAT=DYNAMIC

查询:

INSERT INTO review (RATING,..) VALUES (null,..);

错误消息:

Error: Column 'RATING' cannot be null
SQLState:  23000
ErrorCode: 1048

我也尝试在插入查询中进行不使用RATING的插入,即使它是默认的null和nullable字段,它也会给出相同的错误消息,并且永远不会插入该字段.

I also try to insert without RATING in the insert query, even if it is default null and nullable field, it gives the same error message and never inserts the field.

推荐答案

波西米亚风格,谢谢您的关注.您说得对,我发现有一个插入操作的触发器会影响相关字段.我禁用触发器,错误消失了.谢谢.

Bohemian, thanks for your attention. You are right, i figured out that there is a trigger for insert action which effects the related field. I disable trigger and error is gone. Thanks.

这篇关于mysql-“列不能为空"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆