From 9181c17c143063bd2714c6524772f5b10d412844 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 May 2005 15:42:24 +0300 Subject: [PATCH 1/4] InnoDB: Check all referencing tables in DROP DATABASE (Bug #10335). innobase/row/row0mysql.c: row_drop_table_for_mysql(): Check all referencing tables when drop_db==TRUE (Bug #10335) --- innobase/row/row0mysql.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index a915200161f..86557315b71 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -2143,6 +2143,7 @@ row_drop_table_for_mysql( foreign = UT_LIST_GET_FIRST(table->referenced_list); while (foreign && foreign->foreign_table == table) { + check_next_foreign: foreign = UT_LIST_GET_NEXT(referenced_list, foreign); } @@ -2171,6 +2172,10 @@ row_drop_table_for_mysql( goto funct_exit; } + if (foreign && trx->check_foreigns) { + goto check_next_foreign; + } + if (table->n_mysql_handles_opened > 0) { ibool added; From 80b0baa7405ddb36637ee7ceeb2b15ff90af6635 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 May 2005 17:30:12 +0300 Subject: [PATCH 2/4] fixed problem with long string results of expressions in UNIONS (BUG#10025) mysql-test/r/union.result: test for Bug #10025 mysql-test/t/union.test: test for Bug #10025 sql/item.cc: set HA_OPTION_PACK_RECORD and change type to MYSQL_TYPE_STRING, to allow correct field creation in case of length more then 255 (creation STRING field with length more then 255) --- mysql-test/r/union.result | 14 ++++++++++++++ mysql-test/t/union.test | 11 +++++++++++ sql/item.cc | 4 ++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index c140ecd26e1..57dfd48b6bd 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1235,3 +1235,17 @@ show columns from t2; Field Type Null Key Default Extra a varchar(3) YES NULL drop table t2, t1; +CREATE TABLE t1 (a mediumtext); +CREATE TABLE t2 (b varchar(20)); +INSERT INTO t1 VALUES ('a'),('b'); +SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2; +left(a,100000000) +a +b +create table t3 SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2; +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `left(a,100000000)` longtext +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop tables t1,t2,t3; diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index b0446e1ea4a..ffc7e718e9d 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -742,3 +742,14 @@ create table t2 select a from t1 union select c from t1; create table t2 select a from t1 union select b from t1; show columns from t2; drop table t2, t1; + +# +# correct conversion long string to TEXT (BUG#10025) +# +CREATE TABLE t1 (a mediumtext); +CREATE TABLE t2 (b varchar(20)); +INSERT INTO t1 VALUES ('a'),('b'); +SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2; +create table t3 SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2; +show create table t3; +drop tables t1,t2,t3; diff --git a/sql/item.cc b/sql/item.cc index 59785813566..8bc26c8c679 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -3099,8 +3099,8 @@ Field *Item_type_holder::make_field_by_type(TABLE *table) enum_set_typelib, collation.collation); case MYSQL_TYPE_VAR_STRING: table->db_create_options|= HA_OPTION_PACK_RECORD; - return new Field_string(max_length, maybe_null, name, table, - collation.collation); + fld_type= MYSQL_TYPE_STRING; + break; default: break; } From 360d1cd06d6ea1a803305a5fcfde5a79c16365b7 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 May 2005 12:38:29 +0200 Subject: [PATCH 3/4] don't downgrade the lock for CREATE ... SELECT (bug#6678) --- sql/ha_innodb.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 2d2a8f2c3b4..f0a25fd4f98 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -5420,7 +5420,8 @@ ha_innobase::store_lock( if ((lock_type >= TL_WRITE_CONCURRENT_INSERT && lock_type <= TL_WRITE) && !thd->in_lock_tables - && !thd->tablespace_op) { + && !thd->tablespace_op + && thd->lex->sql_command != SQLCOM_CREATE_TABLE) { lock_type = TL_WRITE_ALLOW_WRITE; } From 755d2018ada199005b70b4836f6fbb56e2e7b892 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 May 2005 14:15:08 +0200 Subject: [PATCH 4/4] forgotten s/__GNUC__/USE_PRAGMA_INTERFACE/ causes compilation faliures --- sql/hash_filo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/hash_filo.h b/sql/hash_filo.h index d1672e1a60c..fc48c3b1540 100644 --- a/sql/hash_filo.h +++ b/sql/hash_filo.h @@ -23,7 +23,7 @@ #ifndef HASH_FILO_H #define HASH_FILO_H -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class interface */ #endif