Skip to content

Commit

Permalink
Merge 10.4 into 10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Sep 4, 2023
2 parents 2db5f1b + d1fca0b commit 59952b2
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 4 deletions.
13 changes: 13 additions & 0 deletions mysql-test/suite/innodb/r/fk_col_alter.result
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,17 @@ DROP TABLE t2, t1;
CREATE TABLE t (a VARCHAR(40), b INT, C INT) ENGINE=InnoDB;
ALTER TABLE t MODIFY a VARCHAR(50), DROP b;
DROP TABLE t;
#
# MDEV-32060 Server aborts when table doesn't
# have referenced index
#
SET SESSION FOREIGN_KEY_CHECKS = OFF;
CREATE TABLE t1 (a VARCHAR(16) KEY, FOREIGN KEY(a) REFERENCES t2(b)) ENGINE=InnoDB;
CREATE TABLE t2 (b VARCHAR(8)) ENGINE=InnoDB;
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
SET SESSION FOREIGN_KEY_CHECKS = ON;
ALTER TABLE t2 MODIFY b VARCHAR(16), ADD KEY(b);
ERROR 42S02: Table 'test.t2' doesn't exist
DROP TABLE t2, t1;
ERROR 42S02: Unknown table 'test.t2'
# End of 10.4 tests
15 changes: 15 additions & 0 deletions mysql-test/suite/innodb/t/fk_col_alter.test
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,19 @@ DROP TABLE t2, t1;
CREATE TABLE t (a VARCHAR(40), b INT, C INT) ENGINE=InnoDB;
ALTER TABLE t MODIFY a VARCHAR(50), DROP b;
DROP TABLE t;

--echo #
--echo # MDEV-32060 Server aborts when table doesn't
--echo # have referenced index
--echo #
SET SESSION FOREIGN_KEY_CHECKS = OFF;
CREATE TABLE t1 (a VARCHAR(16) KEY, FOREIGN KEY(a) REFERENCES t2(b)) ENGINE=InnoDB;
# Following SQL is allowed in 10.6
--error ER_CANT_CREATE_TABLE
CREATE TABLE t2 (b VARCHAR(8)) ENGINE=InnoDB;
SET SESSION FOREIGN_KEY_CHECKS = ON;
--error ER_NO_SUCH_TABLE
ALTER TABLE t2 MODIFY b VARCHAR(16), ADD KEY(b);
--error ER_BAD_TABLE_ERROR
DROP TABLE t2, t1;
--echo # End of 10.4 tests
4 changes: 2 additions & 2 deletions sql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ SET (SQL_SOURCE
${MYSYS_LIBWRAP_SOURCE}
)

IF(CMAKE_C_COMPILER_ID MATCHES "Clang" AND
NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13.0.0")
MY_CHECK_CXX_COMPILER_FLAG(-Wno-unused-but-set-variable)
IF(have_CXX__Wno_unused_but_set_variable)
ADD_COMPILE_FLAGS(${CMAKE_CURRENT_BINARY_DIR}/yy_mariadb.cc
${CMAKE_CURRENT_BINARY_DIR}/yy_oracle.cc
COMPILE_FLAGS "-Wno-unused-but-set-variable")
Expand Down
5 changes: 3 additions & 2 deletions storage/innobase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,9 @@ IF(MSVC)
# on generated file.
TARGET_COMPILE_OPTIONS(innobase PRIVATE "/wd4065")
ENDIF()
IF(CMAKE_C_COMPILER_ID MATCHES "Clang" AND
NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13.0.0")

MY_CHECK_CXX_COMPILER_FLAG(-Wno-unused-but-set-variable)
IF(have_CXX__Wno_unused_but_set_variable)
ADD_COMPILE_FLAGS(pars/pars0grm.cc fts/fts0pars.cc
COMPILE_FLAGS "-Wno-unused-but-set-variable")
ENDIF()
Expand Down
2 changes: 2 additions & 0 deletions storage/innobase/handler/handler0alter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7630,6 +7630,8 @@ bool check_col_is_in_fk_indexes(
{
for (ulint i= 0; i < f->n_fields; i++)
{
if (!f->referenced_index)
continue;
if (f->referenced_index->fields[i].col == col)
{
my_error(ER_FK_COLUMN_CANNOT_CHANGE_CHILD, MYF(0),
Expand Down

0 comments on commit 59952b2

Please sign in to comment.