Loading mysql-test/r/ctype_collate.result +13 −0 Original line number Diff line number Diff line Loading @@ -535,6 +535,19 @@ s2 CHAR(5) COLLATE latin1_swedish_ci); SELECT * FROM t1 WHERE s1 = s2; ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '=' DROP TABLE t1; CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci, s2 CHAR(5) COLLATE latin1_swedish_ci, s3 CHAR(5) COLLATE latin1_bin); INSERT INTO t1 VALUES ('a','A','A'); SELECT * FROM t1 WHERE s1 = s2; ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '=' SELECT * FROM t1 WHERE s1 = s3; s1 s2 s3 SELECT * FROM t1 WHERE s2 = s3; s1 s2 s3 a A A DROP TABLE t1; SET NAMES latin1; CREATE TABLE t1 (s1 char(10) COLLATE latin1_german1_ci, Loading mysql-test/r/union.result +1 −1 Original line number Diff line number Diff line Loading @@ -1103,7 +1103,7 @@ count(*) drop table t1; create table t2 ( a char character set latin1 collate latin1_swedish_ci, b char character set latin1 collate latin1_bin); b char character set latin1 collate latin1_german1_ci); create table t1 as (select a from t2) union (select b from t2); Loading mysql-test/t/ctype_collate.test +12 −0 Original line number Diff line number Diff line Loading @@ -158,6 +158,18 @@ SELECT * FROM t1 WHERE s1 = s2; DROP TABLE t1; CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci, s2 CHAR(5) COLLATE latin1_swedish_ci, s3 CHAR(5) COLLATE latin1_bin); INSERT INTO t1 VALUES ('a','A','A'); --error 1267 SELECT * FROM t1 WHERE s1 = s2; SELECT * FROM t1 WHERE s1 = s3; SELECT * FROM t1 WHERE s2 = s3; DROP TABLE t1; # # Test that optimizer doesn't use indexes with wrong collation # Loading mysql-test/t/union.test +1 −1 Original line number Diff line number Diff line Loading @@ -659,7 +659,7 @@ drop table t1; create table t2 ( a char character set latin1 collate latin1_swedish_ci, b char character set latin1 collate latin1_bin); b char character set latin1 collate latin1_german1_ci); --error 1271 create table t1 as (select a from t2) union Loading sql/ha_innodb.cc +26 −0 Original line number Diff line number Diff line Loading @@ -5380,6 +5380,32 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list) DBUG_RETURN(0); } /********************************************************************* Checks if ALTER TABLE may change the storage engine of the table. Changing storage engines is not allowed for tables for which there are foreign key constraints (parent or child tables). */ bool ha_innobase::can_switch_engines(void) /*=================================*/ { row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; bool can_switch; DBUG_ENTER("ha_innobase::can_switch_engines"); prebuilt->trx->op_info = "determining if there are foreign key constraints"; row_mysql_lock_data_dictionary(prebuilt->trx); can_switch = !UT_LIST_GET_FIRST(prebuilt->table->referenced_list) && !UT_LIST_GET_FIRST(prebuilt->table->foreign_list); row_mysql_unlock_data_dictionary(prebuilt->trx); prebuilt->trx->op_info = ""; DBUG_RETURN(can_switch); } /*********************************************************************** Checks if a table is referenced by a foreign key. The MySQL manual states that a REPLACE is either equivalent to an INSERT, or DELETE(s) + INSERT. Only a Loading Loading
mysql-test/r/ctype_collate.result +13 −0 Original line number Diff line number Diff line Loading @@ -535,6 +535,19 @@ s2 CHAR(5) COLLATE latin1_swedish_ci); SELECT * FROM t1 WHERE s1 = s2; ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '=' DROP TABLE t1; CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci, s2 CHAR(5) COLLATE latin1_swedish_ci, s3 CHAR(5) COLLATE latin1_bin); INSERT INTO t1 VALUES ('a','A','A'); SELECT * FROM t1 WHERE s1 = s2; ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '=' SELECT * FROM t1 WHERE s1 = s3; s1 s2 s3 SELECT * FROM t1 WHERE s2 = s3; s1 s2 s3 a A A DROP TABLE t1; SET NAMES latin1; CREATE TABLE t1 (s1 char(10) COLLATE latin1_german1_ci, Loading
mysql-test/r/union.result +1 −1 Original line number Diff line number Diff line Loading @@ -1103,7 +1103,7 @@ count(*) drop table t1; create table t2 ( a char character set latin1 collate latin1_swedish_ci, b char character set latin1 collate latin1_bin); b char character set latin1 collate latin1_german1_ci); create table t1 as (select a from t2) union (select b from t2); Loading
mysql-test/t/ctype_collate.test +12 −0 Original line number Diff line number Diff line Loading @@ -158,6 +158,18 @@ SELECT * FROM t1 WHERE s1 = s2; DROP TABLE t1; CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci, s2 CHAR(5) COLLATE latin1_swedish_ci, s3 CHAR(5) COLLATE latin1_bin); INSERT INTO t1 VALUES ('a','A','A'); --error 1267 SELECT * FROM t1 WHERE s1 = s2; SELECT * FROM t1 WHERE s1 = s3; SELECT * FROM t1 WHERE s2 = s3; DROP TABLE t1; # # Test that optimizer doesn't use indexes with wrong collation # Loading
mysql-test/t/union.test +1 −1 Original line number Diff line number Diff line Loading @@ -659,7 +659,7 @@ drop table t1; create table t2 ( a char character set latin1 collate latin1_swedish_ci, b char character set latin1 collate latin1_bin); b char character set latin1 collate latin1_german1_ci); --error 1271 create table t1 as (select a from t2) union Loading
sql/ha_innodb.cc +26 −0 Original line number Diff line number Diff line Loading @@ -5380,6 +5380,32 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list) DBUG_RETURN(0); } /********************************************************************* Checks if ALTER TABLE may change the storage engine of the table. Changing storage engines is not allowed for tables for which there are foreign key constraints (parent or child tables). */ bool ha_innobase::can_switch_engines(void) /*=================================*/ { row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; bool can_switch; DBUG_ENTER("ha_innobase::can_switch_engines"); prebuilt->trx->op_info = "determining if there are foreign key constraints"; row_mysql_lock_data_dictionary(prebuilt->trx); can_switch = !UT_LIST_GET_FIRST(prebuilt->table->referenced_list) && !UT_LIST_GET_FIRST(prebuilt->table->foreign_list); row_mysql_unlock_data_dictionary(prebuilt->trx); prebuilt->trx->op_info = ""; DBUG_RETURN(can_switch); } /*********************************************************************** Checks if a table is referenced by a foreign key. The MySQL manual states that a REPLACE is either equivalent to an INSERT, or DELETE(s) + INSERT. Only a Loading