Commit 6fa40b85 authored by Aleksey Midenkov's avatar Aleksey Midenkov

MDEV-23554 Wrong default value for foreign_key_checks variable

Sys_var_bit::session_save_default() ignored reverse_semantics property.
parent 4a90bb85
...@@ -167,7 +167,6 @@ PRIMARY KEY (store_id), ...@@ -167,7 +167,6 @@ PRIMARY KEY (store_id),
UNIQUE KEY idx_unique_manager (manager_staff_id), UNIQUE KEY idx_unique_manager (manager_staff_id),
CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS=DEFAULT;
LOCK TABLE staff WRITE; LOCK TABLE staff WRITE;
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLES staff, store; DROP TABLES staff, store;
......
...@@ -136,7 +136,6 @@ CREATE TABLE store ( ...@@ -136,7 +136,6 @@ CREATE TABLE store (
UNIQUE KEY idx_unique_manager (manager_staff_id), UNIQUE KEY idx_unique_manager (manager_staff_id),
CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS=DEFAULT;
LOCK TABLE staff WRITE; LOCK TABLE staff WRITE;
UNLOCK TABLES; UNLOCK TABLES;
......
...@@ -7,7 +7,7 @@ SET @@session.foreign_key_checks = 1; ...@@ -7,7 +7,7 @@ SET @@session.foreign_key_checks = 1;
SET @@session.foreign_key_checks = DEFAULT; SET @@session.foreign_key_checks = DEFAULT;
SELECT @@session.foreign_key_checks; SELECT @@session.foreign_key_checks;
@@session.foreign_key_checks @@session.foreign_key_checks
0 1
'#---------------------FN_DYNVARS_032_02-------------------------#' '#---------------------FN_DYNVARS_032_02-------------------------#'
SET foreign_key_checks = 1; SET foreign_key_checks = 1;
SELECT @@foreign_key_checks; SELECT @@foreign_key_checks;
......
...@@ -7,7 +7,7 @@ SET @@session.unique_checks= 1; ...@@ -7,7 +7,7 @@ SET @@session.unique_checks= 1;
SET @@session.unique_checks= DEFAULT; SET @@session.unique_checks= DEFAULT;
SELECT @@session.unique_checks; SELECT @@session.unique_checks;
@@session.unique_checks @@session.unique_checks
0 1
'#--------------------FN_DYNVARS_005_04-------------------------#' '#--------------------FN_DYNVARS_005_04-------------------------#'
SET @@session.unique_checks =1; SET @@session.unique_checks =1;
SELECT @@session.unique_checks; SELECT @@session.unique_checks;
......
...@@ -1704,13 +1704,16 @@ public: ...@@ -1704,13 +1704,16 @@ public:
return false; return false;
} }
void session_save_default(THD *thd, set_var *var) void session_save_default(THD *thd, set_var *var)
{ var->save_result.ulonglong_value= global_var(ulonglong) & bitmask; } {
var->save_result.ulonglong_value=
(reverse_semantics == !(global_var(ulonglong) & bitmask));
}
void global_save_default(THD *thd, set_var *var) void global_save_default(THD *thd, set_var *var)
{ var->save_result.ulonglong_value= option.def_value; } { var->save_result.ulonglong_value= option.def_value; }
uchar *valptr(THD *thd, ulonglong val) uchar *valptr(THD *thd, ulonglong val)
{ {
thd->sys_var_tmp.my_bool_value= reverse_semantics ^ ((val & bitmask) != 0); thd->sys_var_tmp.my_bool_value= (reverse_semantics == !(val & bitmask));
return (uchar*) &thd->sys_var_tmp.my_bool_value; return (uchar*) &thd->sys_var_tmp.my_bool_value;
} }
uchar *session_value_ptr(THD *thd, const LEX_STRING *base) uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment