在操作”小弟“这张表时候报错

想在“小弟”上面加入数据或者更新数据,就要听老大的,

这句话后面跟着的表就是“老大”,必须老大有数据索引,“小弟“才可以加入或者更新

查看“小弟”表的外键,会发现有对“老大”表的外键索引。

举例

在要删除或者滞空warehouse_picked_record中logistic_order_detail中的字段会报错

Cannot add or update a child row: a foreign key constraint fails (`susliks`.`warehouse_picked_record`, CONSTRAINT `fk_whip_ref_logistics_detail` FOREIGN KEY (`logisticsorder_detail_id`) REFERENCES `logistics_order_detail` (`order_detail_id`) ON DELETE NO ACT)

针对外键数据库默认是NO ACTION,可以显示列出,CASCADE是级联操作,即当删除父行数据时候,相关联的子行数据也被删除,更新与删除功能相同。

现在如果先删除对应的logistcs_order_detail中的数据,就会发现,对应的warehouse_picked_record也会被自动删除

如果变成no action则要手动删除warehouse_picked_record ,不受logistics_order_detail约束

Cannot delete or update a parent row: a foreign key constraint fails....的更多相关文章

  1. MySQL主从复制中断,报“Error on master: message (format)='Cannot delete or update a parent row: a foreign key constraint fails' error code=1217” 错误

    前几天,发现从库挂了,具体报错信息如下: 分析思路 1. 因为我采用的是选择性复制,只针对以下几个库进行复制: card,upay,deal,monitor,collect.所以,不太可能出现对于sa ...

  2. 【转】 #1451 - Cannot delete or update a parent row: a foreign key constraint fails 问题的解决办法

    转载地址:http://blog.csdn.net/donglynn/article/details/17056099 错误 SQL 查询: DELETE FROM `zmax_lang` WHERE ...

  3. 【转】表删除时 Cannot delete or update a parent row: a foreign key constraint fails 异常处理

    转载地址:http://lijiejava.iteye.com/blog/790478 有两张表,结构如下: t_item:                          t_bid: id    ...

  4. Hibernate级联删除时:Cannot delete or update a parent row: a foreign key constraint fails异常

    在删除主表数据时,报了一个异常 Cannot delete or update a parent row: a foreign key constraint fails 原因是主表中还包含字表的数据, ...

  5. MySQL:ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails

    MySQL在删除一张表时出现 ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fa ...

  6. ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails ()

    centos7.5 删除表空间文件失败 问题: mysql> alter table country discard tablespace; ERROR 1451 (23000): Cannot ...

  7. mysql删除有外链索引数据,Cannot delete or update a parent row: a foreign key constraint fails 问题的解决办法

    mysql删除有外链索引数据Cannot delete or update a parent row: a foreign key constraint fails 问题的解决办法查询:DELETE ...

  8. Mysql之1451 - Cannot delete or update a parent row: a foreign key constraint fails...解决办法记录

    今天使用delete语句删除一张表中的一条信息时,提示了这么一个错误:1451 - Cannot delete or update a parent row: a foreign key constr ...

  9. ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails

    mysql 删除表时提示有外键 mysql> drop tables auth_group;ERROR 1217 (23000): Cannot delete or update a paren ...

  10. 表删除时 Cannot delete or update a parent row: a foreign key constraint fails 异常处理

    有两张表,结构如下: t_item:                          t_bid: id        int                     id        int n ...

随机推荐

  1. ulimit资源配置

    基本理解 linux对每个用户能使用的系统资源有一定限制.如果没有限制,在多用户登录,并且都消耗大量资源时,对系统产生复杂的影响.ulimit内建一套参数,来规定一个用户能使用多少资源. [root@ ...

  2. Android课程设计第六天欢迎界面(跳转)

    注意:课程设计只为完成任务,不做细节描述~ package com.example.myapplication; import android.app.Activity; import android ...

  3. 洛谷 P2261 [CQOI2007]余数求和 ||整除(数论)分块

    参考:题解 令f(i)=k%i,[p]表示不大于p的最大整数f(i)=k%i=k-[k/i]*i令q=[k/i]f(i)=k-qi如果k/(i+1)=k/i=qf(i+1)=k-q(i+1)=k-qi ...

  4. archive log full ora-00257

    ############# sample 0 asmcmd show free 37G in archive_log ASMCMD> lsdgState Type Rebal Unbal Sec ...

  5. memcached随笔练习

    实验环境: RHEL 6.5 (已关闭selinux,iptables) 首先部署LNMP环境,该步骤采用源码编译安装 安装Nginx-1.8.0 准备软件包:nginx-1.8.0.tar.gz 下 ...

  6. 记一次有关spark动态资源分配和消息总线的爬坑经历

    问题: 线上的spark thriftserver运行一段时间以后,ui的executor页面上显示大量的active task,但是从job页面看,并没有任务在跑.此外,由于在yarn mode下, ...

  7. vs直接IP访问运行项目

    找到IIS Express 正在运行的项目应用程序,点击网站,会出现配置路径,找到配置路径,显示隐藏的文件夹 localhost替换成本地IP,重新运行项目,然后就可以直接通过IP访问项目,好处就是便 ...

  8. 【转】数据库CRUD操作

    数据库CRUD操作 一.删除表   drop table 表名称 二.修改表 alter   table 表名称 add  列名 数据类型   (add表示添加一列) alter  table  表名 ...

  9. hdu1513 Palindrome

    思路: dp+滚动数组. 实现: #include <iostream> #include <cstdio> #include <string> #include ...

  10. The lion king 经典句型摘录

    What am I going to do with him? Everything the light touches is our kingdom. But I thought a king ca ...