在处理跨schema添加外键的时候,使用语句添加:
ALTER TABLE `indoor`.`FAS_CABINET` ADD CONSTRAINT `FAS_CABINET_FK01` FOREIGN KEY (`ASSET_MANAGER_GUID`) REFERENCES `storage`.`COMMON_PERSONS` (`GUID`) ON DELETE NO ACTION ON UPDATE NO ACTION;
报错:Error Code: 1822. Failed to add the foreign key constraint. Missing index for constraint 'FAS_CABINET_FK01' in the referenced table 'COMMON_PERSONS'
其中GUID在`storage`.`COMMON_PERSONS`中并非primary key,也不是unique key
解决:可以看到因为GUID不是index导致,所以需要换成指向primary key或者把GUID变成index或者设为unique key
后续:
这个错误是由于跨库导致的,同一个库并没有index这个需要.因此可以使用同义词处理
如果是ORACLE,可以使用synonym来建立指向外部库的表
相关推荐
这篇文章主要涉及到在数据创建表时,遇到ERROR 1215 (HY000): Cannot add foreign key constraint 问题方面的内容,对于在数据创建表时,遇到同样问题感兴趣的同学可以参考一下。 一、问题的提出 创建两个表: ...
Error Correction Coding - Mathematical Methods and Algorithms (Source Files Contained).pdf Error Correction Coding Mathematical Methods and Algorithms Todd K. Moon Utah State University @ E ! C I E N...
ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails 这是因为你尝试删除的表中的字段被用作了其他表的外键,因此在删除这个表(父表)之前必须先删除具有外键的表(子表)...
Plan for Implementation of the SQA Plan . . . . . . . . . . . . . 19 Step 5. Execute the SQA Plan. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Quality Standards. . . . . . . . ...
(1452, 'Cannot add or update a child row: a foreign key constraint fails (`mxonline`.`django_admin_log`, CONSTRAINT `django_admin_log_user_id_c564eba6_fk_auth_user_id` FOREIGN KEY (`user_id`) ...
使用Data.Constraint.Dict和隐式参数解决Haskell记录问题 概述 字典类型输入是我用来解决Haskell中可扩展记录问题的一种编程技术。 它利用ConstraintKinds和ImplicitParams GHC扩展使用Data.Constraint.Dict将隐式...
解决ERROR: Failed to resolve: com.android.support.constraint:constraint-layout: Android studio中没有support repository,放到Android Studio SDK\extras 详见...
IRefPlaneFeatureData::AngleOrDistance, IRefPlaneFeatureData::Constraint, IRefPlaneFeatureData::Reference, and IRefPlaneFeatureData::Type2 and the Remarks section in IRefPlaneFeatureData for details....
Within UML, OCL is the standard for specifying expressions that add vital information to object-oriented models and other object-modeling artifacts. Model-Driven Architecture (MDA) relies on OCL to ...
添加级联操作 语法:ALTER TABLE 表名 ADD CONSTRAINT 外键名称 FOREIGN KEY (外键字段名称) REFERENCES 主表名称(主表列名称) ON UPDATE CASCADE ON DELETE CASCADE ; 2. 分类: 1. 级联更新:ON UPDATE CASCADE 2...
2.然后将jar包添加进去,右键ADD as library 3.在build 的Build type 下可以将其设置为 ComplieOnly compileOnly fileTree(include: ['*.jar'], dir: 'lib') 坑 要 改 成 complieOnly implementation '...
Failed to resolve: com.android.support.constraint:constraint-layout:1.0.0-alpha1
1. Introduction to the Use of Functions in the Management of Data Peter M.D. Gray, Peter J.H. King and Alexandra Poulovassilis.... 1 Introduction to Section I: Advances in Information Modelling ...
A deletion operation will _____ if the deletion leads to the violation of a referential integrity constraint. (a) fail (b) succeed with warning (c) succeed without warning (d) crash the ...
Within UML, OCL is the standard for specifying expressions that add vital information to object-oriented models and other object-modeling artifacts. Model-Driven Architecture (MDA) relies on OCL to ...
Each index row in node pages contains an index key (or set of keys for a composite index) and a pointer to a page at the next level for which the first key value is the same as the key value in the ...
A beautiful gift Cards for android Inspiration comes from dribbble Preview Requirements Use Android Studio 2.2 Preview 5 or higher, as the following are not available in earlier versions: ...
4.2.1 Extended Kalman filter for the scalar case . . . . . . . . . . . . 32 4.2.2 Extended Kalman filter in matrix form. . . . . . . . . . . . . . . 33 4.2.3 Example using the extended Kalman filter ....
Special thanks to the following people for contributing code and bug fixes: * Ben Xin Kang of the University of Hong Kong * Christian Hansen of the University of Hannover * Erik Schreurs from the ...