加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

sqlite foreign key mismatch 外键配置错误

发布时间:2020-12-12 20:26:52 所属栏目:百科 来源:网络整理
导读:foreign key mismatch 原来sqlite建表的时候,不会报外键约束错误,只有当你要删除的时候,才会报错误 sqlite PRAGMA foreign_keys = ON; 设置外键级联有效; 我检查了我的建表语句,果然外键约束是错误的。 官网上是这样较我们的。 The parent table does no
 
foreign key mismatch
原来sqlite建表的时候,不会报外键约束错误,只有当你要删除的时候,才会报错误


sqlite> PRAGMA foreign_keys = ON;
设置外键级联有效;


我检查了我的建表语句,果然外键约束是错误的。

官网上是这样较我们的。

  • The parent table does not exist,or
  • The parent key columns named in the foreign key constraint do not exist,or
  • The parent key columns named in the foreign key constraint are not the primary key of the parent table and are not subject to a unique constraint using collating sequence specified in the CREATE TABLE,or
  • The child table references the primary key of the parent without specifying the primary key columns and the number of primary key columns in the parent do not match the number of child key columns.
参考: http://www.sqlite.org/foreignkeys.html

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读