Skip to content
Permalink
Browse files
MDEV-23554 Wrong default value for foreign_key_checks variable
Sys_var_bit::session_save_default() ignored reverse_semantics property.
  • Loading branch information
midenok committed Aug 25, 2020
1 parent 4a90bb8 commit 6fa40b8
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
@@ -167,7 +167,6 @@ PRIMARY KEY (store_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
) ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS=DEFAULT;
LOCK TABLE staff WRITE;
UNLOCK TABLES;
DROP TABLES staff, store;
@@ -136,7 +136,6 @@ CREATE TABLE store (
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
) ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS=DEFAULT;

LOCK TABLE staff WRITE;
UNLOCK TABLES;
@@ -7,7 +7,7 @@ SET @@session.foreign_key_checks = 1;
SET @@session.foreign_key_checks = DEFAULT;
SELECT @@session.foreign_key_checks;
@@session.foreign_key_checks
0
1
'#---------------------FN_DYNVARS_032_02-------------------------#'
SET foreign_key_checks = 1;
SELECT @@foreign_key_checks;
@@ -7,7 +7,7 @@ SET @@session.unique_checks= 1;
SET @@session.unique_checks= DEFAULT;
SELECT @@session.unique_checks;
@@session.unique_checks
0
1
'#--------------------FN_DYNVARS_005_04-------------------------#'
SET @@session.unique_checks =1;
SELECT @@session.unique_checks;
@@ -1704,13 +1704,16 @@ public:
return false;
}
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)
{ var->save_result.ulonglong_value= option.def_value; }

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;
}
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)

0 comments on commit 6fa40b8

Please sign in to comment.