diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c index 602f5855171..0b563eb147e 100644 --- a/innobase/row/row0sel.c +++ b/innobase/row/row0sel.c @@ -2524,13 +2524,21 @@ row_sel_store_mysql_rec( (byte) (templ->mysql_null_bit_mask); switch (templ->type) { case DATA_VARCHAR: - case DATA_CHAR: case DATA_BINARY: + case DATA_VARMYSQL: + if (templ->mysql_type + == DATA_MYSQL_TRUE_VARCHAR) { + /* This is a >= 5.0.3 type + true VARCHAR. Zero the field. */ + pad_char = 0x00; + break; + } + /* Fall through */ + case DATA_CHAR: case DATA_FIXBINARY: case DATA_MYSQL: - case DATA_VARMYSQL: - /* MySQL pads all non-BLOB and non-TEXT - string types with space ' ' */ + /* MySQL pads all string types (except + BLOB, TEXT and true VARCHAR) with space. */ if (UNIV_UNLIKELY(templ->mbminlen == 2)) { /* Treat UCS2 as a special case. */ data = mysql_rec diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 89b3df0a83b..5c95d7b39d8 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -940,3 +940,12 @@ f5 19 NULL f6 1 NULL f7 64 NULL drop table t1; +create table t1 (f1 integer); +create trigger tr1 after insert on t1 for each row set @test_var=42; +use information_schema; +select trigger_schema, trigger_name from triggers where +trigger_name='tr1'; +trigger_schema trigger_name +test tr1 +use test; +drop table t1; diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 2c73cbeeea4..2bdec5125dd 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1452,16 +1452,16 @@ Error 1146 Table 'test.t4' doesn't exist checksum table t1, t2, t3, t4; Table Checksum test.t1 2948697075 -test.t2 1157260244 -test.t3 1157260244 +test.t2 3835700799 +test.t3 3835700799 test.t4 NULL Warnings: Error 1146 Table 'test.t4' doesn't exist checksum table t1, t2, t3, t4 extended; Table Checksum test.t1 3092701434 -test.t2 1157260244 -test.t3 1157260244 +test.t2 3835700799 +test.t3 3835700799 test.t4 NULL Warnings: Error 1146 Table 'test.t4' doesn't exist diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 5468508165c..8ab591e18d0 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -525,3 +525,15 @@ set @@warning_count=1; ERROR HY000: Variable 'warning_count' is a read only variable set @@global.error_count=1; ERROR HY000: Variable 'error_count' is a read only variable +set @@max_heap_table_size= 4294967296; +select @@max_heap_table_size; +@@max_heap_table_size +4294967296 +set global max_heap_table_size= 4294967296; +select @@max_heap_table_size; +@@max_heap_table_size +4294967296 +set @@max_heap_table_size= 4294967296; +select @@max_heap_table_size; +@@max_heap_table_size +4294967296 diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index f13a29f07ad..a8fc75f8aa4 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -622,3 +622,14 @@ select column_name, NUMERIC_PRECISION, NUMERIC_SCALE from information_schema.columns where table_name='t1'; drop table t1; + +# +# Bug #12127 triggers do not show in info_schema before they are used if set to the database +# +create table t1 (f1 integer); +create trigger tr1 after insert on t1 for each row set @test_var=42; +use information_schema; +select trigger_schema, trigger_name from triggers where +trigger_name='tr1'; +use test; +drop table t1; diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index d9fba14b802..1dae1812347 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -408,3 +408,13 @@ drop table t1; set @@warning_count=1; --error 1238 set @@global.error_count=1; + +# +# Bug #10351: Setting max_heap_table_size to 4G fails +# +set @@max_heap_table_size= 4294967296; +select @@max_heap_table_size; +set global max_heap_table_size= 4294967296; +select @@max_heap_table_size; +set @@max_heap_table_size= 4294967296; +select @@max_heap_table_size; diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 1c3bca08037..d40e58aa4cb 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -216,10 +216,10 @@ static handlerton innobase_hton = { innobase_xa_recover, /* recover */ innobase_commit_by_xid, /* commit_by_xid */ innobase_rollback_by_xid, /* rollback_by_xid */ - NULL, - NULL, - NULL, - HTON_CLOSE_CURSORS_AT_COMMIT + innobase_create_cursor_view, + innobase_set_cursor_view, + innobase_close_cursor_view, + HTON_NO_FLAGS }; /********************************************************************* diff --git a/sql/hostname.cc b/sql/hostname.cc index 12b69a97859..3b1eeb63d37 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -143,8 +143,8 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors) *errors=0; /* We always treat the loopback address as "localhost". */ - if (in->s_addr == INADDR_LOOPBACK) - return (char *)my_localhost; + if (in->s_addr == htonl(INADDR_LOOPBACK)) // is expanded inline by gcc + DBUG_RETURN((char *)my_localhost); /* Check first if we have name in cache */ if (!(specialflag & SPECIAL_NO_HOST_CACHE)) diff --git a/sql/item.h b/sql/item.h index a17c2af2823..d3e920faa68 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1151,6 +1151,7 @@ class Item_uint :public Item_int public: Item_uint(const char *str_arg, uint length); Item_uint(uint32 i) :Item_int((ulonglong) i, 10) {} + Item_uint(ulong i) :Item_int((ulonglong) i, 10) {} Item_uint(const char *str_arg, longlong i, uint length); double val_real() { DBUG_ASSERT(fixed == 1); return ulonglong2double((ulonglong)value); } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 74b0e024905..26d8cc07235 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5371,7 +5371,7 @@ The minimum value for this variable is 4096.", "Limit assumed max number of seeks when looking up rows based on a key", (gptr*) &global_system_variables.max_seeks_for_key, (gptr*) &max_system_variables.max_seeks_for_key, 0, GET_ULONG, - REQUIRED_ARG, ~0L, 1, ~0L, 0, 1, 0 }, + REQUIRED_ARG, UINT_MAX32, 1, UINT_MAX32, 0, 1, 0 }, {"max_sort_length", OPT_MAX_SORT_LENGTH, "The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored).", (gptr*) &global_system_variables.max_sort_length, diff --git a/sql/set_var.cc b/sql/set_var.cc index 09581aed217..5cdd4081614 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1679,7 +1679,7 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base) pthread_mutex_lock(&LOCK_global_system_variables); value= *(uint*) value_ptr(thd, var_type, base); pthread_mutex_unlock(&LOCK_global_system_variables); - return new Item_uint((int32) value); + return new Item_uint((uint32) value); } case SHOW_LONG: { @@ -1687,7 +1687,7 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base) pthread_mutex_lock(&LOCK_global_system_variables); value= *(ulong*) value_ptr(thd, var_type, base); pthread_mutex_unlock(&LOCK_global_system_variables); - return new Item_uint((int32) value); + return new Item_uint(value); } case SHOW_LONGLONG: { diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index ee16b219421..976fac3d9c9 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -520,6 +520,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, char path_buff[FN_REFLEN]; LEX_STRING path; File_parser *parser; + LEX_STRING save_db; DBUG_ENTER("Table_triggers_list::check_n_load"); @@ -580,6 +581,10 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, thd->lex= &lex; + save_db.str= thd->db; + save_db.length= thd->db_length; + thd->db_length= strlen(db); + thd->db= (char *) db; while ((trg_create_str= it++)) { lex_start(thd, (uchar*)trg_create_str->str, trg_create_str->length); @@ -622,6 +627,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, lex_end(&lex); } + thd->db= save_db.str; + thd->db_length= save_db.length; thd->lex= old_lex; DBUG_RETURN(0); @@ -630,6 +637,8 @@ err_with_lex_cleanup: // QQ: anything else ? lex_end(&lex); thd->lex= old_lex; + thd->db= save_db.str; + thd->db_length= save_db.length; DBUG_RETURN(1); }