Cannot add or update a child row: a foreign key constraint fails***********
Cannot add or update a child row: a foreign key constraint fails。。。。。。出现这个问题不要慌,最先从字段下手,直接找到外键,看主表跟从表的数据类型和数据是否一致,因为副表是根据主表里边的主键(或unique字段)插入的,只要不一致就会发生这个问题,我出现的问题是postman发送数据的时候,request失败,code=500,然后IDEA中报错信息如上。例子:例如我的数据库seed表主键seed_id是recommend表的外键:
原创
2020-12-30 20:54:38 ·
3981 阅读 ·
0 评论