mysql - “column cannot be null”

℡╲_俬逩灬. 提交于 2019-12-20 01:09:55

问题


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!

Any help would be appreciated.

EDITED

Create:

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

Query:

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

Error message:

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

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.


回答1:


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.



来源:https://stackoverflow.com/questions/6248983/mysql-column-cannot-be-null

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!