Bug #121262 SET SESSION foreign_key_checks = DEFAULT incorrectly sets the session value to 0
Submitted: 10 Sep 8:06 Modified: 11 Sep 2:14
Reporter: Xiaoyuan Xie Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:9.7.2 OS:Ubuntu
Assigned to: CPU Architecture:Any

[10 Sep 8:06] Xiaoyuan Xie
Description:
In MySQL 9.7.2, SET SESSION foreign_key_checks = DEFAULT unexpectedly changes @@SESSION.foreign_key_checks from 1 to 0.

How to repeat:
SELECT @@SESSION.foreign_key_checks;
-- Returns: 1

SET SESSION foreign_key_checks = DEFAULT;

SELECT @@SESSION.foreign_key_checks;

Actual Result: 0

Expected Result: 1

SET SESSION foreign_key_checks = DEFAULT should not change the session value from 1 to 0 when the corresponding default value is 1.
[10 Sep 8:17] Xiaoyuan Xie
I also observed the same behavior with `unique_checks` in MySQL 9.7.2:

SELECT @@SESSION.unique_checks;
-- Returns: 1

SET SESSION unique_checks = DEFAULT;
SELECT @@SESSION.unique_checks;

Actual Result: 0
Expected Result: 1

Could you please confirm whether the `unique_checks` issue is a duplicate of this `foreign_key_checks` bug, or whether they are caused by the same underlying issue?