Commit 03977e82 authored by Eugene Kosov's avatar Eugene Kosov Committed by Marko Mäkelä

MDEV-13671 InnoDB should use case-insensitive column name comparisons like the rest of the server

Problem affects INPLACE ALTER rename columns.

innobase_rename_column_try(): some strcmp() was replaced with my_strcasecmp(),
queries to update data dictionary was updated to not match column name case.
parent f0cb21ea
......@@ -714,6 +714,7 @@ t2 CREATE TABLE `t2` (
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
ALTER TABLE t1 CHANGE COLUMN c1 C1 INT;
ALTER TABLE t2 CHANGE COLUMN c2 C2 INT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
......@@ -723,24 +724,147 @@ t1 CREATE TABLE `t1` (
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c2` int(11) NOT NULL,
KEY `c2` (`c2`),
`C2` int(11) DEFAULT NULL,
KEY `c2` (`C2`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
ALTER TABLE t1 CHANGE COLUMN C1 c5 INT;
ALTER TABLE t2 CHANGE COLUMN C2 c6 INT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`C1` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`C1`)
`c5` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`c5`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c2` int(11) NOT NULL,
KEY `c2` (`c2`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`)
`c6` int(11) DEFAULT NULL,
KEY `c2` (`c6`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c6`) REFERENCES `t1` (`c5`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID
WHERE T.NAME='test/t1';
NAME
c5
SELECT F.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS F INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_INDEXES I ON F.INDEX_ID=I.INDEX_ID INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON I.TABLE_ID=T.TABLE_ID
WHERE T.NAME='test/t1' AND I.NAME='PRIMARY';
NAME
c5
SELECT C.REF_COL_NAME, C.FOR_COL_NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS C INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_FOREIGN F ON C.ID=F.ID
WHERE F.FOR_NAME='test/t2';
REF_COL_NAME FOR_COL_NAME
c5 c6
DROP TABLE t2, t1;
# virtual columns case too
CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (a) VIRTUAL) ENGINE = InnoDB;
ALTER TABLE t1 CHANGE COLUMN a A INT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`A` int(11) DEFAULT NULL,
`b` int(11) AS (a) VIRTUAL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID
WHERE T.NAME='test/t1';
NAME
a
DROP TABLE t1;
# different FOREIGN KEY cases
CREATE TABLE t1 (
a INT UNIQUE KEY,
b INT UNIQUE KEY,
c INT UNIQUE KEY,
d INT UNIQUE KEY
) ENGINE=INNODB;
CREATE TABLE t2 (
aa INT,
bb INT,
cc INT,
dd INT
) ENGINE=INNODB;
INSERT INTO t1 VALUES (1, 1, 1, 1);
INSERT INTO t2 VALUES (1, 1, 1, 1);
ALTER TABLE t1 CHANGE a A INT, ALGORITHM=INPLACE;
ALTER TABLE t1 CHANGE c C INT, ALGORITHM=INPLACE;
ALTER TABLE t2 CHANGE cc CC INT, ALGORITHM=INPLACE;
ALTER TABLE t2 CHANGE dd DD INT, ALGORITHM=INPLACE;
SET foreign_key_checks=0;
ALTER TABLE t2
ADD FOREIGN KEY(aa) REFERENCES t1(a),
ADD FOREIGN KEY(bb) REFERENCES t1(b),
ADD FOREIGN KEY(cc) REFERENCES t1(c),
ADD FOREIGN KEY(dd) REFERENCES t1(d),
ALGORITHM=INPLACE;
ALTER TABLE t1 CHANGE b B INT, ALGORITHM=INPLACE;
ALTER TABLE t2 CHANGE aa AA INT, ALGORITHM=INPLACE;
ALTER TABLE t1 CHANGE d D INT, ALGORITHM=INPLACE;
ALTER TABLE t2 CHANGE bb BB INT, ALGORITHM=INPLACE;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`A` int(11) DEFAULT NULL,
`B` int(11) DEFAULT NULL,
`C` int(11) DEFAULT NULL,
`D` int(11) DEFAULT NULL,
UNIQUE KEY `a` (`A`),
UNIQUE KEY `b` (`B`),
UNIQUE KEY `c` (`C`),
UNIQUE KEY `d` (`D`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`AA` int(11) DEFAULT NULL,
`BB` int(11) DEFAULT NULL,
`CC` int(11) DEFAULT NULL,
`DD` int(11) DEFAULT NULL,
KEY `aa` (`AA`),
KEY `bb` (`BB`),
KEY `CC` (`CC`),
KEY `DD` (`DD`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`),
CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`bb`) REFERENCES `t1` (`b`),
CONSTRAINT `t2_ibfk_3` FOREIGN KEY (`cc`) REFERENCES `t1` (`c`),
CONSTRAINT `t2_ibfk_4` FOREIGN KEY (`dd`) REFERENCES `t1` (`d`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DELETE FROM t1 WHERE a=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE A=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE b=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE B=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE c=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE C=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE d=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE D=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DROP TABLE t2, t1;
# virtual columns case too
CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (a) VIRTUAL) ENGINE = InnoDB;
ALTER TABLE t1 CHANGE COLUMN a A INT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`A` int(11) DEFAULT NULL,
`b` int(11) AS (a) VIRTUAL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID
WHERE T.NAME='test/t1';
NAME
a
DROP TABLE t1;
#
# BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN
# DICT_MEM_TABLE_COL_RENAME_LOW
......
......@@ -419,15 +419,110 @@ CREATE TABLE t2(c2 INT NOT NULL, FOREIGN KEY(c2) REFERENCES t1(c1))ENGINE=INNODB
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t2;
ALTER TABLE t1 CHANGE COLUMN c1 C1 INT;
ALTER TABLE t2 CHANGE COLUMN c2 C2 INT;
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t2;
# FIXME: MDEV-13671 InnoDB should use case-insensitive column name comparisons
# like the rest of the server
#ALTER TABLE t1 CHANGE COLUMN C1 c5 INT;
ALTER TABLE t1 CHANGE COLUMN C1 c5 INT;
ALTER TABLE t2 CHANGE COLUMN C2 c6 INT;
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t2;
SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID
WHERE T.NAME='test/t1';
SELECT F.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS F INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_INDEXES I ON F.INDEX_ID=I.INDEX_ID INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON I.TABLE_ID=T.TABLE_ID
WHERE T.NAME='test/t1' AND I.NAME='PRIMARY';
SELECT C.REF_COL_NAME, C.FOR_COL_NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS C INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_FOREIGN F ON C.ID=F.ID
WHERE F.FOR_NAME='test/t2';
DROP TABLE t2, t1;
--echo # virtual columns case too
CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (a) VIRTUAL) ENGINE = InnoDB;
ALTER TABLE t1 CHANGE COLUMN a A INT;
SHOW CREATE TABLE t1;
SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID
WHERE T.NAME='test/t1';
DROP TABLE t1;
--echo # different FOREIGN KEY cases
CREATE TABLE t1 (
a INT UNIQUE KEY,
b INT UNIQUE KEY,
c INT UNIQUE KEY,
d INT UNIQUE KEY
) ENGINE=INNODB;
CREATE TABLE t2 (
aa INT,
bb INT,
cc INT,
dd INT
) ENGINE=INNODB;
INSERT INTO t1 VALUES (1, 1, 1, 1);
INSERT INTO t2 VALUES (1, 1, 1, 1);
ALTER TABLE t1 CHANGE a A INT, ALGORITHM=INPLACE;
ALTER TABLE t1 CHANGE c C INT, ALGORITHM=INPLACE;
ALTER TABLE t2 CHANGE cc CC INT, ALGORITHM=INPLACE;
ALTER TABLE t2 CHANGE dd DD INT, ALGORITHM=INPLACE;
SET foreign_key_checks=0;
ALTER TABLE t2
ADD FOREIGN KEY(aa) REFERENCES t1(a),
ADD FOREIGN KEY(bb) REFERENCES t1(b),
ADD FOREIGN KEY(cc) REFERENCES t1(c),
ADD FOREIGN KEY(dd) REFERENCES t1(d),
ALGORITHM=INPLACE;
ALTER TABLE t1 CHANGE b B INT, ALGORITHM=INPLACE;
ALTER TABLE t2 CHANGE aa AA INT, ALGORITHM=INPLACE;
--source include/restart_mysqld.inc
ALTER TABLE t1 CHANGE d D INT, ALGORITHM=INPLACE;
ALTER TABLE t2 CHANGE bb BB INT, ALGORITHM=INPLACE;
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t2;
--error ER_ROW_IS_REFERENCED_2
DELETE FROM t1 WHERE a=1;
--error ER_ROW_IS_REFERENCED_2
DELETE FROM t1 WHERE A=1;
--error ER_ROW_IS_REFERENCED_2
DELETE FROM t1 WHERE b=1;
--error ER_ROW_IS_REFERENCED_2
DELETE FROM t1 WHERE B=1;
--error ER_ROW_IS_REFERENCED_2
DELETE FROM t1 WHERE c=1;
--error ER_ROW_IS_REFERENCED_2
DELETE FROM t1 WHERE C=1;
--error ER_ROW_IS_REFERENCED_2
DELETE FROM t1 WHERE d=1;
--error ER_ROW_IS_REFERENCED_2
DELETE FROM t1 WHERE D=1;
DROP TABLE t2, t1;
--echo # virtual columns case too
CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (a) VIRTUAL) ENGINE = InnoDB;
ALTER TABLE t1 CHANGE COLUMN a A INT;
SHOW CREATE TABLE t1;
SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID
WHERE T.NAME='test/t1';
DROP TABLE t1;
--echo #
--echo # BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN
--echo # DICT_MEM_TABLE_COL_RENAME_LOW
......
......@@ -498,9 +498,7 @@ dict_mem_table_col_rename(
s += len + 1;
}
/* This could fail if the data dictionaries are out of sync.
Proceed with the renaming anyway. */
ut_ad(!strcmp(from, s));
ut_ad(!my_strcasecmp(system_charset_info, from, s));
dict_mem_table_col_rename_low(table, nth_col, to, s);
}
......
......@@ -4514,7 +4514,6 @@ innobase_rename_column_try(
pars_info_add_ull_literal(info, "tableid", user_table->id);
pars_info_add_int4_literal(info, "nth", nth_col);
pars_info_add_str_literal(info, "old", from);
pars_info_add_str_literal(info, "new", to);
trx->op_info = "renaming column in SYS_COLUMNS";
......@@ -4524,7 +4523,7 @@ innobase_rename_column_try(
"PROCEDURE RENAME_SYS_COLUMNS_PROC () IS\n"
"BEGIN\n"
"UPDATE SYS_COLUMNS SET NAME=:new\n"
"WHERE TABLE_ID=:tableid AND NAME=:old\n"
"WHERE TABLE_ID=:tableid\n"
"AND POS=:nth;\n"
"END;\n",
FALSE, trx);
......@@ -4548,8 +4547,10 @@ innobase_rename_column_try(
index = dict_table_get_next_index(index)) {
for (ulint i = 0; i < dict_index_get_n_fields(index); i++) {
if (strcmp(dict_index_get_nth_field(index, i)->name,
from)) {
if (my_strcasecmp(
system_charset_info,
dict_index_get_nth_field(index, i)->name,
from)) {
continue;
}
......@@ -4557,7 +4558,6 @@ innobase_rename_column_try(
pars_info_add_ull_literal(info, "indexid", index->id);
pars_info_add_int4_literal(info, "nth", i);
pars_info_add_str_literal(info, "old", from);
pars_info_add_str_literal(info, "new", to);
error = que_eval_sql(
......@@ -4566,14 +4566,14 @@ innobase_rename_column_try(
"BEGIN\n"
"UPDATE SYS_FIELDS SET COL_NAME=:new\n"
"WHERE INDEX_ID=:indexid AND COL_NAME=:old\n"
"WHERE INDEX_ID=:indexid\n"
"AND POS=:nth;\n"
/* Try again, in case there is a prefix_len
encoded in SYS_FIELDS.POS */
"UPDATE SYS_FIELDS SET COL_NAME=:new\n"
"WHERE INDEX_ID=:indexid AND COL_NAME=:old\n"
"WHERE INDEX_ID=:indexid\n"
"AND POS>=65536*:nth AND POS<65536*(:nth+1);\n"
"END;\n",
......@@ -4599,7 +4599,9 @@ innobase_rename_column_try(
foreign_modified = false;
for (unsigned i = 0; i < foreign->n_fields; i++) {
if (strcmp(foreign->foreign_col_names[i], from)) {
if (my_strcasecmp(system_charset_info,
foreign->foreign_col_names[i],
from)) {
continue;
}
......@@ -4607,7 +4609,6 @@ innobase_rename_column_try(
pars_info_add_str_literal(info, "id", foreign->id);
pars_info_add_int4_literal(info, "nth", i);
pars_info_add_str_literal(info, "old", from);
pars_info_add_str_literal(info, "new", to);
error = que_eval_sql(
......@@ -4616,8 +4617,7 @@ innobase_rename_column_try(
"BEGIN\n"
"UPDATE SYS_FOREIGN_COLS\n"
"SET FOR_COL_NAME=:new\n"
"WHERE ID=:id AND POS=:nth\n"
"AND FOR_COL_NAME=:old;\n"
"WHERE ID=:id AND POS=:nth;\n"
"END;\n",
FALSE, trx);
......@@ -4641,7 +4641,9 @@ innobase_rename_column_try(
dict_foreign_t* foreign = *it;
for (unsigned i = 0; i < foreign->n_fields; i++) {
if (strcmp(foreign->referenced_col_names[i], from)) {
if (my_strcasecmp(system_charset_info,
foreign->referenced_col_names[i],
from)) {
continue;
}
......@@ -4649,7 +4651,6 @@ innobase_rename_column_try(
pars_info_add_str_literal(info, "id", foreign->id);
pars_info_add_int4_literal(info, "nth", i);
pars_info_add_str_literal(info, "old", from);
pars_info_add_str_literal(info, "new", to);
error = que_eval_sql(
......@@ -4658,8 +4659,7 @@ innobase_rename_column_try(
"BEGIN\n"
"UPDATE SYS_FOREIGN_COLS\n"
"SET REF_COL_NAME=:new\n"
"WHERE ID=:id AND POS=:nth\n"
"AND REF_COL_NAME=:old;\n"
"WHERE ID=:id AND POS=:nth;\n"
"END;\n",
FALSE, trx);
......
......@@ -499,9 +499,7 @@ dict_mem_table_col_rename(
s += len + 1;
}
/* This could fail if the data dictionaries are out of sync.
Proceed with the renaming anyway. */
ut_ad(!strcmp(from, s));
ut_ad(!my_strcasecmp(system_charset_info, from, s));
dict_mem_table_col_rename_low(table, nth_col, to, s);
}
......
......@@ -4516,7 +4516,6 @@ innobase_rename_column_try(
pars_info_add_ull_literal(info, "tableid", user_table->id);
pars_info_add_int4_literal(info, "nth", nth_col);
pars_info_add_str_literal(info, "old", from);
pars_info_add_str_literal(info, "new", to);
trx->op_info = "renaming column in SYS_COLUMNS";
......@@ -4526,7 +4525,7 @@ innobase_rename_column_try(
"PROCEDURE RENAME_SYS_COLUMNS_PROC () IS\n"
"BEGIN\n"
"UPDATE SYS_COLUMNS SET NAME=:new\n"
"WHERE TABLE_ID=:tableid AND NAME=:old\n"
"WHERE TABLE_ID=:tableid\n"
"AND POS=:nth;\n"
"END;\n",
FALSE, trx);
......@@ -4550,8 +4549,10 @@ innobase_rename_column_try(
index = dict_table_get_next_index(index)) {
for (ulint i = 0; i < dict_index_get_n_fields(index); i++) {
if (strcmp(dict_index_get_nth_field(index, i)->name,
from)) {
if (my_strcasecmp(
system_charset_info,
dict_index_get_nth_field(index, i)->name,
from)) {
continue;
}
......@@ -4559,7 +4560,6 @@ innobase_rename_column_try(
pars_info_add_ull_literal(info, "indexid", index->id);
pars_info_add_int4_literal(info, "nth", i);
pars_info_add_str_literal(info, "old", from);
pars_info_add_str_literal(info, "new", to);
error = que_eval_sql(
......@@ -4568,14 +4568,14 @@ innobase_rename_column_try(
"BEGIN\n"
"UPDATE SYS_FIELDS SET COL_NAME=:new\n"
"WHERE INDEX_ID=:indexid AND COL_NAME=:old\n"
"WHERE INDEX_ID=:indexid\n"
"AND POS=:nth;\n"
/* Try again, in case there is a prefix_len
encoded in SYS_FIELDS.POS */
"UPDATE SYS_FIELDS SET COL_NAME=:new\n"
"WHERE INDEX_ID=:indexid AND COL_NAME=:old\n"
"WHERE INDEX_ID=:indexid\n"
"AND POS>=65536*:nth AND POS<65536*(:nth+1);\n"
"END;\n",
......@@ -4601,7 +4601,9 @@ innobase_rename_column_try(
foreign_modified = false;
for (unsigned i = 0; i < foreign->n_fields; i++) {
if (strcmp(foreign->foreign_col_names[i], from)) {
if (my_strcasecmp(system_charset_info,
foreign->foreign_col_names[i],
from)) {
continue;
}
......@@ -4609,7 +4611,6 @@ innobase_rename_column_try(
pars_info_add_str_literal(info, "id", foreign->id);
pars_info_add_int4_literal(info, "nth", i);
pars_info_add_str_literal(info, "old", from);
pars_info_add_str_literal(info, "new", to);
error = que_eval_sql(
......@@ -4618,8 +4619,7 @@ innobase_rename_column_try(
"BEGIN\n"
"UPDATE SYS_FOREIGN_COLS\n"
"SET FOR_COL_NAME=:new\n"
"WHERE ID=:id AND POS=:nth\n"
"AND FOR_COL_NAME=:old;\n"
"WHERE ID=:id AND POS=:nth;\n"
"END;\n",
FALSE, trx);
......@@ -4643,7 +4643,9 @@ innobase_rename_column_try(
dict_foreign_t* foreign = *it;
for (unsigned i = 0; i < foreign->n_fields; i++) {
if (strcmp(foreign->referenced_col_names[i], from)) {
if (my_strcasecmp(system_charset_info,
foreign->referenced_col_names[i],
from)) {
continue;
}
......@@ -4651,7 +4653,6 @@ innobase_rename_column_try(
pars_info_add_str_literal(info, "id", foreign->id);
pars_info_add_int4_literal(info, "nth", i);
pars_info_add_str_literal(info, "old", from);
pars_info_add_str_literal(info, "new", to);
error = que_eval_sql(
......@@ -4660,8 +4661,7 @@ innobase_rename_column_try(
"BEGIN\n"
"UPDATE SYS_FOREIGN_COLS\n"
"SET REF_COL_NAME=:new\n"
"WHERE ID=:id AND POS=:nth\n"
"AND REF_COL_NAME=:old;\n"
"WHERE ID=:id AND POS=:nth;\n"
"END;\n",
FALSE, trx);
......
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