mysql的decimal(10,0) not null问题


今天排查一个bug发现开发环境老是报错 order_num 字段insert的时候不能为空,但是发现测试环境没有这个问题。

后来发现测试环境有一个数据库docker安装的mysql 版本是5.7  而开发环境是5.7.24  怀疑是这个问题引起的。

后来测试了一下果然,在5.7中执行如下语句只会warning并且把order_num写入0  但是5.7.24会直接报错

create table t_instance_struct_2
(
struct_id varchar(36) not null,
task_code varchar(30),
order_num decimal(10,0) not null,
primary key (struct_id)
);

 

insert into t_instance_struct_2 values ('1','aa',null),('2','aa2',null);


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM