开发者

mysql - "column cannot be 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!

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.


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 disabled the trigger and the error is fixed. Thanks.


First of all look your "datetime / created_at / updated_at" field, do not assign the default value, select current time. after that you can can update the fields name

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜