mysql - “column cannot be null”

2020-04-08 11:37发布

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.

标签: mysql null
1条回答
forever°为你锁心
2楼-- · 2020-04-08 11:58

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.

查看更多
登录 后发表回答