Bug #62602 An option to ignore foreign key checks
Submitted: 3 Oct 2011 3:16 Modified: 27 Jan 2013 16:20
Reporter: Shantanu Oak Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:any OS:Any
Assigned to: CPU Architecture:Any
Tags: foreign_key_checks

[3 Oct 2011 3:16] Shantanu Oak
Description:

While testing /developing an application I need a way to disable foreign key checks completely. Currently I am using init_connect for this purpose.
mysql> SET GLOBAL init_connect='SET foreign_key_checks = 0';

There have been a few bugs for the init_connect option and a user with SUPER privileges 'does not' execute the init_connect option. I will like to see an opton that can be added at command prompt or in my.cnf just like any other parameter.

I will like to see a global option like "ignore_foreign_key_checks" that will disable foreign_key_checks completely without changing table type or altering tables. I should be able to add it to my.cnf and restart service so that it will allow me test the application without worrying about the data dependencies.

How to repeat:
Currently there is no way to (other than setting init_connect) to disable foreign key checks across the DB for all users / threads.

Suggested fix:
Adding a global option something like "ignore_foreign_key_checks"
[3 Oct 2011 6:36] Valeriy Kravchuk
Thank you for the feature request.
[3 Oct 2011 9:11] MySQL Verification Team
It should be possible to disable this option on system start up, often it is not used on just a per connection basis. It has been given global scope, so it should have the full set of possibilities to disable it right from server start up.

There are workarounds, but they are just that, ways to address the missing option functionality that should be implemented, or should have been implemented from the beginning.
[27 Jan 2013 16:20] Shantanu Oak
An option to disable foreign keys is important to all.