草庐IT

foreign_gem

全部标签

mysql - Impossible MySQL insert ... select foreign key constraint error‽

这让我感到困惑,希望有人能提供帮助。查询:insertinto`shelter_pages`(`userid`,`relid`)select:userid,`id`from`shelter`where`stage`='egg'orderbyrand()limit30很简单吧?随机取30行符合条件的行,并将它们与用户ID一起保存在“pages”表中。错误:SQLSTATE[23000]:Integrityconstraintviolation:1452Cannotaddorupdateachildrow:aforeignkeyconstraintfails(`db_name`.`shel

Mysql 转储还原失败 : Cannot add foreign key constraint

我正在尝试恢复使用mysqldump创建的转储。在恢复相同时,我得到了这个ERROR1215(HY000)atline63:CannotaddforeignkeyconstraintDROPTABLEIFEXISTS`channel_tags`;/*!40101SET@saved_cs_client=@@character_set_client*/;/*!40101SETcharacter_set_client=utf8*/;CREATETABLE`channel_tags`(`channel_tag_id`bigint(20)NOTNULLAUTO_INCREMENT,`channe

mysql - 如何在 OS X 10.5.4 下安装 mysql ruby​​ gem

这是交易。$gem--version1.1.0$sudogeminstallmysql----with-mysql-config=/usr/local/mysql/bin/mysql_configBulkupdatingGemsourceindexfor:http://gems.rubyforge.org/ERROR:couldnotfindmysqllocallyorinarepository$sudogem更新UpdatinginstalledgemsBulkupdatingGemsourceindexfor:http://gems.rubyforge.org/UpdatingRe

php - SQLSTATE[23000] : Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails - Laravel

我知道这个问题已经被问过了,但我仍然找不到我做错了什么。我正在使用Laravel框架。我有2个表(用户和位置)。当我想创建一个用户时,我收到错误消息:SQLSTATE[23000]:Integrityconstraintviolation:1452Cannotaddorupdateachildrow:aforeignkeyconstraintfails(festival_aid.users,CONSTRAINTfk_users_locations1FOREIGNKEY(location_id)REFERENCESlocations(location_id)ONDELETECASCADE

mysql - 为什么存在外键时为 'foreign key constraint fails'?

我有一个简单的查询UPDATE`t_timecard_detail`SET`timeoff_request_id`='adad8e0d-c22b-41c3-a460-6cf982729299'WHERE`id`='cfc7a0a1-4e03-46a4-af89-069a0661cf55';这给出了这个错误ERROR1452(23000):Cannotaddorupdateachildrow:aforeignkeyconstraintfails(`demo1_timeapp`.`t_timecard_detail`,CONSTRAINT`timeoff_request_id_refs_i

mysql - 在 Debian Squeeze 上安装 mysql2 gem 时出错

我在DebianSqueeze上安装mysql2gem时遇到这个“常见”错误:geminstallmysql2Buildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingmysql2:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.2-p290/bin/rubyextconf.rbcheckingforrb_thread_blocking_region()...yescheckingforrb_wait_for_singl

mysql - 'SET foreign_key_checks = 1' 不再起作用

我正在与:mysql:stable5.6.22(bottled)MySQL工作台6.2我有以下顺序DROPTABLEIFEXISTSinvoicedetail;DROPTABLEIFEXISTSinvoiceheader;DROPTABLEIFEXISTSproduct;当我通过Java(JDBC)工作时失败并且通过MySQLWorkBench也失败,错误消息是关于FK子约束(我没有确切的错误消息),好吧谷歌我做了一项研究,我发现了两次相同的有效解决方案。Cannotdeleteorupdateaparentrow:aforeignkeyconstraintfailsHowtotemp

mysql - 无法从 Sequel gem 连接 mysql

当我尝试从Sequel连接到MySQL时。我收到这些错误:require'rubygems'require'sequel'DB=Sequel.connect(:adapter=>'mysql',:user=>'root',:host=>'localhost',:database=>'scanty',:password=>'xx')DB.tablesSequel::DatabaseConnectionError:NameErroruninitializedconstantMysql::CLIENT_MULTI_RESULTSfrom/opt/local/lib/ruby/gems/1.8

mysql - 'SET foreign_key_checks = 0' 的范围是什么?

这个问题在这里已经有了答案:DoesMySQLforeign_key_checksaffecttheentiredatabase?(6个答案)关闭9年前。真的找不到任何细节,但是“SETforeign_key_checks=0”的范围是当前连接、当前session还是当前事务?

mysql - 确认 SET FOREIGN KEY CHECKS 设置为 = 1

我想使用phpmyadmin删除并重新创建同一个表。DROPTABLEIFEXISTS`product_entity`;CREATETABLE`product_entity`(......);我收到错误信息Cannotdeleteorupdateaparentrow:aforeignkeyconstraintfails然后我设置SETFOREIGN_KEY_CHECKS=0;DROPTABLEIFEXISTS`product_entity`;SETFOREIGN_KEY_CHECKS=1;CREATETABLE`product_entity`(......);我的问题是如何验证SETF