Browse Source

MDEV-34392 Inplace algorithm violates the foreign key constraint

- Fix the compilation error in gcc-5
bb-10.5-mdev-27650
Thirunarayanan Balathandayuthapani 1 year ago
parent
commit
65418ca9ad
  1. 11
      sql/table.h
  2. 8
      storage/innobase/handler/ha_innodb.cc
  3. 7
      storage/innobase/handler/handler0alter.cc

11
sql/table.h

@ -1927,7 +1927,14 @@ public:
DBUG_ASSERT(fields_nullable); DBUG_ASSERT(fields_nullable);
DBUG_ASSERT(field < n_fields); DBUG_ASSERT(field < n_fields);
size_t bit= size_t{field} + referenced * n_fields; size_t bit= size_t{field} + referenced * n_fields;
fields_nullable[bit / 8]|= (unsigned char)(1 << (bit % 8));
#if defined __GNUC__ && __GNUC__ == 5
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wconversion"
#endif
fields_nullable[bit / 8]|= static_cast<unsigned char>(1 << (bit % 8));
#if defined __GNUC__ && __GNUC__ == 5
# pragma GCC diagnostic pop
#endif
} }
/** /**
@ -1944,7 +1951,7 @@ public:
unsigned n_field= get_n_fields(); unsigned n_field= get_n_fields();
DBUG_ASSERT(field < n_field); DBUG_ASSERT(field < n_field);
size_t bit= size_t{field} + referenced * n_field; size_t bit= size_t{field} + referenced * n_field;
return fields_nullable[bit / 8] & (1 << (bit % 8));
return fields_nullable[bit / 8] & (1U << (bit % 8));
} }
} FOREIGN_KEY_INFO; } FOREIGN_KEY_INFO;

8
storage/innobase/handler/ha_innodb.cc

@ -12518,7 +12518,10 @@ create_table_info_t::create_foreign_keys()
} }
} }
} }
#if defined __GNUC__ && __GNUC__ == 5
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wconversion"
#endif
switch (fk->delete_opt) { switch (fk->delete_opt) {
case FK_OPTION_UNDEF: case FK_OPTION_UNDEF:
case FK_OPTION_RESTRICT: case FK_OPTION_RESTRICT:
@ -12560,6 +12563,9 @@ create_table_info_t::create_foreign_keys()
ut_ad(0); ut_ad(0);
break; break;
} }
#if defined __GNUC__ && __GNUC__ == 5
# pragma GCC diagnostic pop
#endif
} }
if (dict_foreigns_has_s_base_col(local_fk_set, table)) { if (dict_foreigns_has_s_base_col(local_fk_set, table)) {

7
storage/innobase/handler/handler0alter.cc

@ -2807,6 +2807,10 @@ innobase_set_foreign_key_option(
break; break;
} }
#if defined __GNUC__ && __GNUC__ == 5
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wconversion"
#endif
switch (fk_key->update_opt) { switch (fk_key->update_opt) {
case FK_OPTION_NO_ACTION: case FK_OPTION_NO_ACTION:
case FK_OPTION_RESTRICT: case FK_OPTION_RESTRICT:
@ -2823,6 +2827,9 @@ innobase_set_foreign_key_option(
break; break;
} }
#if defined __GNUC__ && __GNUC__ == 5
# pragma GCC diagnostic pop
#endif
return(innobase_check_fk_option(foreign)); return(innobase_check_fk_option(foreign));
} }

Loading…
Cancel
Save