diff options
author | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2010-01-24 00:09:23 +0300 |
---|---|---|
committer | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2010-01-24 00:09:23 +0300 |
commit | 7b5f5d5c37b0a59a04645007cc44446274666832 (patch) | |
tree | 5e503468493119925995d64ea920534747a99d04 /sql | |
parent | 12318ab2a3a80b2230de8c7d98060b41a6972e25 (diff) | |
parent | ed79d2ecbbb6b88d328dd32cba3e53051744e9dc (diff) | |
download | mariadb-git-7b5f5d5c37b0a59a04645007cc44446274666832.tar.gz |
Manual merge of mysql-5.1-bugteam into mysql-trunk-merge.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/event_data_objects.cc | 2 | ||||
-rw-r--r-- | sql/events.cc | 14 | ||||
-rw-r--r-- | sql/ha_partition.cc | 63 | ||||
-rw-r--r-- | sql/item.cc | 2 | ||||
-rw-r--r-- | sql/log.cc | 23 | ||||
-rw-r--r-- | sql/log_event.cc | 39 | ||||
-rw-r--r-- | sql/log_event_old.cc | 39 | ||||
-rw-r--r-- | sql/mysql_priv.h | 18 | ||||
-rw-r--r-- | sql/mysqld.cc | 29 | ||||
-rw-r--r-- | sql/set_var.cc | 4 | ||||
-rw-r--r-- | sql/share/errmsg-utf8.txt | 8 | ||||
-rw-r--r-- | sql/share/errmsg.txt | 11 | ||||
-rw-r--r-- | sql/sql_class.h | 1 | ||||
-rw-r--r-- | sql/sql_db.cc | 5 | ||||
-rw-r--r-- | sql/sql_parse.cc | 37 | ||||
-rw-r--r-- | sql/sql_partition.cc | 55 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 2 | ||||
-rw-r--r-- | sql/sql_select.cc | 1 | ||||
-rw-r--r-- | sql/sql_select.h | 12 | ||||
-rw-r--r-- | sql/sql_show.cc | 9 | ||||
-rw-r--r-- | sql/sql_table.cc | 23 | ||||
-rw-r--r-- | sql/sql_view.cc | 4 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 37 | ||||
-rw-r--r-- | sql/table.cc | 5 |
24 files changed, 238 insertions, 205 deletions
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index 23eec749a30..235f6a37eeb 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -1403,7 +1403,7 @@ Event_job_data::execute(THD *thd, bool drop) #endif if (check_access(thd, EVENT_ACL, dbname.str, - 0, 0, 0, is_schema_db(dbname.str))) + 0, 0, 0, is_schema_db(dbname.str, dbname.length))) { /* This aspect of behavior is defined in the worklog, diff --git a/sql/events.cc b/sql/events.cc index f7ff2b0ccf1..42b48ae75b0 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -415,7 +415,8 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, DBUG_ASSERT(parse_data->expression || parse_data->execute_at); if (check_access(thd, EVENT_ACL, parse_data->dbname.str, 0, 0, 0, - is_schema_db(parse_data->dbname.str))) + is_schema_db(parse_data->dbname.str, + parse_data->dbname.length))) DBUG_RETURN(TRUE); if (check_db_dir_existence(parse_data->dbname.str)) @@ -526,7 +527,8 @@ Events::update_event(THD *thd, Event_parse_data *parse_data, DBUG_RETURN(TRUE); if (check_access(thd, EVENT_ACL, parse_data->dbname.str, 0, 0, 0, - is_schema_db(parse_data->dbname.str))) + is_schema_db(parse_data->dbname.str, + parse_data->dbname.length))) DBUG_RETURN(TRUE); if (new_dbname) /* It's a rename */ @@ -548,7 +550,7 @@ Events::update_event(THD *thd, Event_parse_data *parse_data, access it. */ if (check_access(thd, EVENT_ACL, new_dbname->str, 0, 0, 0, - is_schema_db(new_dbname->str))) + is_schema_db(new_dbname->str, new_dbname->length))) DBUG_RETURN(TRUE); /* Check that the target database exists */ @@ -653,7 +655,7 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists) DBUG_RETURN(TRUE); if (check_access(thd, EVENT_ACL, dbname.str, 0, 0, 0, - is_schema_db(dbname.str))) + is_schema_db(dbname.str, dbname.length))) DBUG_RETURN(TRUE); /* @@ -811,7 +813,7 @@ Events::show_create_event(THD *thd, LEX_STRING dbname, LEX_STRING name) DBUG_RETURN(TRUE); if (check_access(thd, EVENT_ACL, dbname.str, 0, 0, 0, - is_schema_db(dbname.str))) + is_schema_db(dbname.str, dbname.length))) DBUG_RETURN(TRUE); /* @@ -869,7 +871,7 @@ Events::fill_schema_events(THD *thd, TABLE_LIST *tables, COND * /* cond */) if (thd->lex->sql_command == SQLCOM_SHOW_EVENTS) { DBUG_ASSERT(thd->lex->select_lex.db); - if (!is_schema_db(thd->lex->select_lex.db) && // There is no events in I_S + if (!is_schema_db(thd->lex->select_lex.db) && // There is no events in I_S check_access(thd, EVENT_ACL, thd->lex->select_lex.db, 0, 0, 0, 0)) DBUG_RETURN(1); db= thd->lex->select_lex.db; diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 52c2c8e47cb..04b7e9d7523 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1272,17 +1272,28 @@ int ha_partition::prepare_new_partition(TABLE *tbl, partition_element *p_elem) { int error; - bool create_flag= FALSE; DBUG_ENTER("prepare_new_partition"); if ((error= set_up_table_before_create(tbl, part_name, create_info, 0, p_elem))) - goto error; + goto error_create; if ((error= file->ha_create(part_name, tbl, create_info))) - goto error; - create_flag= TRUE; + { + /* + Added for safety, InnoDB reports HA_ERR_FOUND_DUPP_KEY + if the table/partition already exists. + If we return that error code, then print_error would try to + get_dup_key on a non-existing partition. + So return a more reasonable error code. + */ + if (error == HA_ERR_FOUND_DUPP_KEY) + error= HA_ERR_TABLE_EXIST; + goto error_create; + } + DBUG_PRINT("info", ("partition %s created", part_name)); if ((error= file->ha_open(tbl, part_name, m_mode, m_open_test_lock))) - goto error; + goto error_open; + DBUG_PRINT("info", ("partition %s opened", part_name)); /* Note: if you plan to add another call that may return failure, better to do it before external_lock() as cleanup_new_partition() @@ -1290,12 +1301,15 @@ int ha_partition::prepare_new_partition(TABLE *tbl, Otherwise see description for cleanup_new_partition(). */ if ((error= file->ha_external_lock(ha_thd(), m_lock_type))) - goto error; + goto error_external_lock; + DBUG_PRINT("info", ("partition %s external locked", part_name)); DBUG_RETURN(0); -error: - if (create_flag) - VOID(file->ha_delete_table(part_name)); +error_external_lock: + VOID(file->close()); +error_open: + VOID(file->ha_delete_table(part_name)); +error_create: DBUG_RETURN(error); } @@ -1329,19 +1343,23 @@ error: void ha_partition::cleanup_new_partition(uint part_count) { - handler **save_m_file= m_file; DBUG_ENTER("ha_partition::cleanup_new_partition"); - if (m_added_file && m_added_file[0]) + if (m_added_file) { - m_file= m_added_file; - m_added_file= NULL; + THD *thd= ha_thd(); + handler **file= m_added_file; + while ((part_count > 0) && (*file)) + { + (*file)->ha_external_lock(thd, F_UNLCK); + (*file)->close(); - external_lock(ha_thd(), F_UNLCK); - /* delete_table also needed, a bit more complex */ - close(); + /* Leave the (*file)->ha_delete_table(part_name) to the ddl-log */ - m_file= save_m_file; + file++; + part_count--; + } + m_added_file= NULL; } DBUG_VOID_RETURN; } @@ -1647,7 +1665,15 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, part_elem->part_state= PART_TO_BE_DROPPED; } m_new_file= new_file_array; - DBUG_RETURN(copy_partitions(copied, deleted)); + if ((error= copy_partitions(copied, deleted))) + { + /* + Close and unlock the new temporary partitions. + They will later be deleted through the ddl-log. + */ + cleanup_new_partition(part_count); + } + DBUG_RETURN(error); } @@ -1736,6 +1762,7 @@ int ha_partition::copy_partitions(ulonglong * const copied, } DBUG_RETURN(FALSE); error: + m_reorged_file[reorg_part]->ha_rnd_end(); DBUG_RETURN(result); } diff --git a/sql/item.cc b/sql/item.cc index ba920497ec1..b52619ceee0 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -5305,7 +5305,7 @@ int Item::save_in_field(Field *field, bool no_conversions) field->set_notnull(); error=field->store(nr, unsigned_flag); } - return error; + return error ? error : (field->table->in_use->is_error() ? 2 : 0); } diff --git a/sql/log.cc b/sql/log.cc index 14329397b28..f846aac55bc 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -4306,12 +4306,20 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info) #if defined(USING_TRANSACTIONS) /* Should we write to the binlog cache or to the binlog on disk? + Write to the binlog cache if: - - it is already not empty (meaning we're in a transaction; note that the - present event could be about a non-transactional table, but still we need - to write to the binlog cache in that case to handle updates to mixed - trans/non-trans table types the best possible in binlogging) - - or if the event asks for it (cache_stmt == TRUE). + 1 - a transactional engine/table is updated (stmt_has_updated_trans_table == TRUE); + 2 - or the event asks for it (cache_stmt == TRUE); + 3 - or the cache is already not empty (meaning we're in a transaction; + note that the present event could be about a non-transactional table, but + still we need to write to the binlog cache in that case to handle updates + to mixed trans/non-trans table types). + + Write to the binlog on disk if only a non-transactional engine is + updated and: + 1 - the binlog cache is empty or; + 2 - --binlog-direct-non-transactional-updates is set and we are about to + use the statement format. When using the row format (cache_stmt == TRUE). */ if (opt_using_transactions && thd) { @@ -4322,8 +4330,9 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info) (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton); IO_CACHE *trans_log= &trx_data->trans_log; my_off_t trans_log_pos= my_b_tell(trans_log); - if (event_info->get_cache_stmt() || trans_log_pos != 0 || - stmt_has_updated_trans_table(thd)) + if (event_info->get_cache_stmt() || stmt_has_updated_trans_table(thd) || + (!thd->variables.binlog_direct_non_trans_update && + trans_log_pos != 0)) { DBUG_PRINT("info", ("Using trans_log: cache: %d, trans_log_pos: %lu", event_info->get_cache_stmt(), diff --git a/sql/log_event.cc b/sql/log_event.cc index c05fe00fc42..e27b0e7b981 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -8733,24 +8733,6 @@ static bool record_compare(TABLE *table) } } - /** - Check if we are using MyISAM. - - If this is a myisam table, then we cannot do a memcmp - right away because some NULL fields can still contain - an old value in the row - they are not shown to the user - because the null bit is set, however, the contents are - not cleared. As such, plain memory comparison cannot be - assured to work. See: BUG#49482 and BUG#49481. - - On top of this, we do not store field contents for null - fields in the binlog, so this is extra important when - comparing records fetched from binlog and from storage - engine. - */ - if (table->file->ht->db_type == DB_TYPE_MYISAM) - goto record_compare_field_by_field; - if (table->s->blob_fields + table->s->varchar_fields == 0) { result= cmp_record(table,record[1]); @@ -8766,33 +8748,14 @@ static bool record_compare(TABLE *table) goto record_compare_exit; } -record_compare_field_by_field: - /* Compare updated fields */ for (Field **ptr=table->field ; *ptr ; ptr++) { - Field *f= *ptr; - - /* if just one of the fields is null then there is no match */ - if ((f->is_null_in_record(table->record[0])) == - !(f->is_null_in_record(table->record[1]))) + if ((*ptr)->cmp_binary_offset(table->s->rec_buff_length)) { result= TRUE; goto record_compare_exit; } - - /* if both fields are not null then we can compare */ - if (!(f->is_null_in_record(table->record[0])) && - !(f->is_null_in_record(table->record[1]))) - { - if (f->cmp_binary_offset(table->s->rec_buff_length)) - { - result= TRUE; - goto record_compare_exit; - } - } - - /* if both fields are null then there is a match. compare next field */ } record_compare_exit: diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index a9470d03da2..fbcbb388236 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -323,24 +323,6 @@ static bool record_compare(TABLE *table) } } - /** - Check if we are using MyISAM. - - If this is a myisam table, then we cannot do a memcmp - right away because some NULL fields can still contain - an old value in the row - they are not shown to the user - because the null bit is set, however, the contents are - not cleared. As such, plain memory comparison cannot be - assured to work. See: BUG#49482 and BUG#49481. - - On top of this, we do not store field contents for null - fields in the binlog, so this is extra important when - comparing records fetched from binlog and from storage - engine. - */ - if (table->file->ht->db_type == DB_TYPE_MYISAM) - goto record_compare_field_by_field; - if (table->s->blob_fields + table->s->varchar_fields == 0) { result= cmp_record(table,record[1]); @@ -356,33 +338,14 @@ static bool record_compare(TABLE *table) goto record_compare_exit; } -record_compare_field_by_field: - /* Compare updated fields */ for (Field **ptr=table->field ; *ptr ; ptr++) { - Field *f= *ptr; - - /* if just one of the fields is null then there is no match */ - if ((f->is_null_in_record(table->record[0])) == - !(f->is_null_in_record(table->record[1]))) + if ((*ptr)->cmp_binary_offset(table->s->rec_buff_length)) { result= TRUE; goto record_compare_exit; } - - /* if both fields are not null then we can compare */ - if (!(f->is_null_in_record(table->record[0])) && - !(f->is_null_in_record(table->record[1]))) - { - if (f->cmp_binary_offset(table->s->rec_buff_length)) - { - result= TRUE; - goto record_compare_exit; - } - } - - /* if both fields are null then there is a match. compare next field */ } record_compare_exit: diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index b539e004481..87e18db14aa 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -121,6 +121,10 @@ char* query_table_status(THD *thd,const char *db,const char *table_name); #define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1)) #define all_bits_set(A,B) ((A) & (B) != (B)) +/* Version numbers for deprecation messages */ +#define VER_BETONY "5.5" +#define VER_CELOSIA "5.6" + #define WARN_DEPRECATED(Thd,Ver,Old,New) \ do { \ DBUG_ASSERT(strncmp(Ver, MYSQL_SERVER_VERSION, sizeof(Ver)-1) > 0); \ @@ -1365,8 +1369,18 @@ bool get_schema_tables_result(JOIN *join, enum enum_schema_table_state executed_place); enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table); -#define is_schema_db(X) \ - !my_strcasecmp(system_charset_info, INFORMATION_SCHEMA_NAME.str, (X)) +inline bool is_schema_db(const char *name, size_t len) +{ + return (INFORMATION_SCHEMA_NAME.length == len && + !my_strcasecmp(system_charset_info, + INFORMATION_SCHEMA_NAME.str, name)); +} + +inline bool is_schema_db(const char *name) +{ + return !my_strcasecmp(system_charset_info, + INFORMATION_SCHEMA_NAME.str, name); +} /* sql_handler.cc */ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index b9bcd407a19..aad06cd5445 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5633,6 +5633,7 @@ enum options_mysqld OPT_DISCONNECT_SLAVE_EVENT_COUNT, OPT_TC_HEURISTIC_RECOVER, OPT_ABORT_SLAVE_EVENT_COUNT, OPT_LOG_BIN_TRUST_FUNCTION_CREATORS, + OPT_LOG_BIN_TRUST_FUNCTION_CREATORS_OLD, OPT_ENGINE_CONDITION_PUSHDOWN, OPT_NDB_CONNECTSTRING, OPT_NDB_USE_EXACT_COUNT, OPT_NDB_USE_TRANSACTIONS, OPT_NDB_FORCE_SEND, OPT_NDB_AUTOINCREMENT_PREFETCH_SZ, @@ -5714,6 +5715,7 @@ enum options_mysqld OPT_EXPIRE_LOGS_DAYS, OPT_GROUP_CONCAT_MAX_LEN, OPT_DEFAULT_COLLATION, + OPT_DEFAULT_COLLATION_OLD, OPT_CHARACTER_SET_CLIENT_HANDSHAKE, OPT_CHARACTER_SET_FILESYSTEM, OPT_LC_ERROR_MESSAGES, @@ -5763,7 +5765,8 @@ enum options_mysqld OPT_IGNORE_BUILTIN_INNODB, OPT_SYNC_RELAY_LOG, OPT_SYNC_RELAY_LOG_INFO, - OPT_SYNC_MASTER_INFO + OPT_SYNC_MASTER_INFO, + OPT_BINLOG_DIRECT_NON_TRANS_UPDATE }; @@ -5892,7 +5895,7 @@ struct my_option my_long_options[] = {"default-character-set", 'C', "Set the default character set (deprecated option, use --character-set-server instead).", (uchar**) &default_character_set_name, (uchar**) &default_character_set_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, - {"default-collation", OPT_DEFAULT_COLLATION, "Set the default collation (deprecated option, use --collation-server instead).", + {"default-collation", OPT_DEFAULT_COLLATION_OLD, "Set the default collation (deprecated option, use --collation-server instead).", (uchar**) &default_collation_name, (uchar**) &default_collation_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, {"default-storage-engine", OPT_STORAGE_ENGINE, @@ -6032,7 +6035,7 @@ each time the SQL thread starts.", compatibility; the behaviour was also changed to apply only to functions (and triggers). In a future release this old name could be removed. */ - {"log-bin-trust-routine-creators", OPT_LOG_BIN_TRUST_FUNCTION_CREATORS, + {"log-bin-trust-routine-creators", OPT_LOG_BIN_TRUST_FUNCTION_CREATORS_OLD, "(deprecated) Use log-bin-trust-function-creators.", (uchar**) &trust_function_creators, (uchar**) &trust_function_creators, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -7138,6 +7141,10 @@ The minimum value for this variable is 4096.", (uchar**) &max_system_variables.net_wait_timeout, 0, GET_ULONG, REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT), 0, 1, 0}, + {"binlog-direct-non-transactional-updates", OPT_BINLOG_DIRECT_NON_TRANS_UPDATE, + "Causes updates to non-transactional engines using statement format to be written directly to binary log. Before using this option make sure that there are no dependencies between transactional and non-transactional tables such as in the statement INSERT INTO t_myisam SELECT * FROM t_innodb; otherwise, slaves may diverge from the master.", + (uchar**) &global_system_variables.binlog_direct_non_trans_update, (uchar**) &max_system_variables.binlog_direct_non_trans_update, 0, GET_BOOL, NO_ARG, 0, + 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -8001,6 +8008,9 @@ mysqld_get_one_option(int optid, #endif opt_endinfo=1; /* unireg: memory allocation */ break; + case '0': + WARN_DEPRECATED(NULL, VER_CELOSIA, "--log-long-format", "--log-short-format"); + break; case 'a': global_system_variables.sql_mode= fix_sql_mode(MODE_ANSI); global_system_variables.tx_isolation= ISO_SERIALIZABLE; @@ -8009,6 +8019,7 @@ mysqld_get_one_option(int optid, strmake(mysql_home,argument,sizeof(mysql_home)-1); break; case 'C': + WARN_DEPRECATED(NULL, VER_CELOSIA, "--default-character-set", "--character-set-server"); if (default_collation_name == compiled_default_collation_name) default_collation_name= 0; break; @@ -8031,6 +8042,9 @@ mysqld_get_one_option(int optid, case 'L': strmake(lc_messages_dir, argument, sizeof(lc_messages_dir)-1); break; + case 'O': + WARN_DEPRECATED(NULL, VER_CELOSIA, "--set-variable", "--variable-name=value"); + break; #ifdef HAVE_REPLICATION case OPT_SLAVE_SKIP_ERRORS: init_slave_skip_errors(argument); @@ -8065,6 +8079,15 @@ mysqld_get_one_option(int optid, test_flags= argument ? (uint) atoi(argument) : 0; opt_endinfo=1; break; + case (int) OPT_DEFAULT_COLLATION_OLD: + WARN_DEPRECATED(NULL, VER_CELOSIA, "--default-collation", "--collation-server"); + break; + case (int) OPT_SAFE_SHOW_DB: + WARN_DEPRECATED(NULL, VER_CELOSIA, "--safe-show-database", "GRANT SHOW DATABASES"); + break; + case (int) OPT_LOG_BIN_TRUST_FUNCTION_CREATORS_OLD: + WARN_DEPRECATED(NULL, VER_CELOSIA, "--log-bin-trust-routine-creators", "--log-bin-trust-function-creators"); + break; case (int) OPT_BIG_TABLES: thd_startup_options|=OPTION_BIG_TABLES; break; diff --git a/sql/set_var.cc b/sql/set_var.cc index 8d88c676cb7..0c189704bca 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -183,6 +183,8 @@ static sys_var_long_ptr sys_binlog_cache_size(&vars, "binlog_cache_size", &binlog_cache_size); static sys_var_thd_binlog_format sys_binlog_format(&vars, "binlog_format", &SV::binlog_format); +static sys_var_thd_bool sys_binlog_direct_non_trans_update(&vars, "binlog_direct_non_transactional_updates", + &SV::binlog_direct_non_trans_update); static sys_var_thd_ulong sys_bulk_insert_buff_size(&vars, "bulk_insert_buffer_size", &SV::bulk_insert_buff_size); static sys_var_const_os sys_character_sets_dir(&vars, @@ -4282,7 +4284,7 @@ bool process_key_caches(process_key_cache_t func) void sys_var_trust_routine_creators::warn_deprecated(THD *thd) { - WARN_DEPRECATED(thd, "6.0", "@@log_bin_trust_routine_creators", + WARN_DEPRECATED(thd, VER_CELOSIA, "@@log_bin_trust_routine_creators", "'@@log_bin_trust_function_creators'"); } diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 03d7ff30f7e..db99890235a 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -5132,11 +5132,11 @@ ER_SP_BADSTATEMENT 0A000 eng "%s is not allowed in stored procedures" ger "%s ist in gespeicherten Prozeduren nicht erlaubt" ER_UPDATE_LOG_DEPRECATED_IGNORED 42000 - eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored" - ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wird ignoriert" + eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored. This option will be removed in MySQL 5.6." + ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wird ignoriert. Diese Option wird in MySQL 5.6 entfernt." ER_UPDATE_LOG_DEPRECATED_TRANSLATED 42000 - eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN" - ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wurde in SET SQL_LOG_BIN übersetzt" + eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN. This option will be removed in MySQL 5.6." + ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wurde in SET SQL_LOG_BIN übersetzt. Diese Option wird in MySQL 5.6 entfernt." ER_QUERY_INTERRUPTED 70100 eng "Query execution was interrupted" ger "Ausführung der Abfrage wurde unterbrochen" diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index ea2ce2b58b0..b5f227e5550 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5132,11 +5132,11 @@ ER_SP_BADSTATEMENT 0A000 eng "%s is not allowed in stored procedures" ger "%s ist in gespeicherten Prozeduren nicht erlaubt" ER_UPDATE_LOG_DEPRECATED_IGNORED 42000 - eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored" - ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wird ignoriert" + eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored. This option will be removed in MySQL 5.6." + ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wird ignoriert. Diese Option wird in MySQL 5.6 entfernt." ER_UPDATE_LOG_DEPRECATED_TRANSLATED 42000 - eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN" - ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wurde in SET SQL_LOG_BIN übersetzt" + eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN. This option will be removed in MySQL 5.6." + ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wurde in SET SQL_LOG_BIN übersetzt. Diese Option wird in MySQL 5.6 entfernt." ER_QUERY_INTERRUPTED 70100 eng "Query execution was interrupted" ger "Ausführung der Abfrage wurde unterbrochen" @@ -6240,7 +6240,8 @@ ER_UNKNOWN_LOCALE ER_SLAVE_IGNORE_SERVER_IDS eng "The requested server id %d clashes with the slave startup option --replicate-same-server-id" - +ER_QUERY_CACHE_DISABLED + eng "Query cache is disabled; restart the server with query_cache_type=1 to enable it" ER_SAME_NAME_PARTITION_FIELD eng "Duplicate partition field name '%-.192s'" ER_PARTITION_COLUMN_LIST_ERROR diff --git a/sql/sql_class.h b/sql/sql_class.h index 2a77d8de7cd..0f1269b525d 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -384,6 +384,7 @@ struct system_variables ulong ndb_index_stat_cache_entries; ulong ndb_index_stat_update_freq; ulong binlog_format; // binlog format for this thd (see enum_binlog_format) + my_bool binlog_direct_non_trans_update; /* In slave thread we need to know in behalf of which thread the query is being run to replicate temp tables properly diff --git a/sql/sql_db.cc b/sql/sql_db.cc index b0f473aa211..9081f74c73b 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -619,7 +619,7 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, DBUG_ENTER("mysql_create_db"); /* do not create 'information_schema' db */ - if (!my_strcasecmp(system_charset_info, db, INFORMATION_SCHEMA_NAME.str)) + if (is_schema_db(db)) { my_error(ER_DB_CREATE_EXISTS, MYF(0), db); DBUG_RETURN(-1); @@ -1558,8 +1558,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch) } } - if (my_strcasecmp(system_charset_info, new_db_name->str, - INFORMATION_SCHEMA_NAME.str) == 0) + if (is_schema_db(new_db_name->str, new_db_name->length)) { /* Switch the current database to INFORMATION_SCHEMA. */ diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 39e80660e51..aef07579e28 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1324,8 +1324,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, table_list.alias= table_list.table_name= conv_name.str; packet= arg_end + 1; - if (!my_strcasecmp(system_charset_info, table_list.db, - INFORMATION_SCHEMA_NAME.str)) + if (is_schema_db(table_list.db, table_list.db_length)) { ST_SCHEMA_TABLE *schema_table= find_schema_table(thd, table_list.alias); if (schema_table) @@ -1387,7 +1386,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, break; } if (check_access(thd, CREATE_ACL, db.str , 0, 1, 0, - is_schema_db(db.str))) + is_schema_db(db.str, db.length))) break; general_log_print(thd, command, "%.*s", db.length, db.str); bzero(&create_info, sizeof(create_info)); @@ -1406,7 +1405,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, my_error(ER_WRONG_DB_NAME, MYF(0), db.str ? db.str : "NULL"); break; } - if (check_access(thd, DROP_ACL, db.str, 0, 1, 0, is_schema_db(db.str))) + if (check_access(thd, DROP_ACL, db.str, 0, 1, 0, + is_schema_db(db.str, db.length))) break; if (thd->locked_tables || thd->active_transaction()) { @@ -2703,6 +2703,8 @@ case SQLCOM_PREPARE: { lex->link_first_table_back(create_table, link_to_local); create_table->create= TRUE; + /* Base table and temporary table are not in the same name space. */ + create_table->skip_temporary= 1; } if (!(res= open_and_lock_tables(thd, lex->query_tables))) @@ -3727,7 +3729,7 @@ end_with_restore_list: } #endif if (check_access(thd,CREATE_ACL,lex->name.str, 0, 1, 0, - is_schema_db(lex->name.str))) + is_schema_db(lex->name.str, lex->name.length))) break; res= mysql_create_db(thd,(lower_case_table_names == 2 ? alias : lex->name.str), &create_info, 0); @@ -3762,7 +3764,7 @@ end_with_restore_list: } #endif if (check_access(thd,DROP_ACL,lex->name.str,0,1,0, - is_schema_db(lex->name.str))) + is_schema_db(lex->name.str, lex->name.length))) break; if (thd->locked_tables || thd->active_transaction()) { @@ -3796,9 +3798,12 @@ end_with_restore_list: my_error(ER_WRONG_DB_NAME, MYF(0), db->str); break; } - if (check_access(thd, ALTER_ACL, db->str, 0, 1, 0, is_schema_db(db->str)) || - check_access(thd, DROP_ACL, db->str, 0, 1, 0, is_schema_db(db->str)) || - check_access(thd, CREATE_ACL, db->str, 0, 1, 0, is_schema_db(db->str))) + if (check_access(thd, ALTER_ACL, db->str, 0, 1, 0, + is_schema_db(db->str, db->length)) || + check_access(thd, DROP_ACL, db->str, 0, 1, 0, + is_schema_db(db->str, db->length)) || + check_access(thd, CREATE_ACL, db->str, 0, 1, 0, + is_schema_db(db->str, db->length))) { res= 1; break; @@ -3841,7 +3846,8 @@ end_with_restore_list: break; } #endif - if (check_access(thd, ALTER_ACL, db->str, 0, 1, 0, is_schema_db(db->str))) + if (check_access(thd, ALTER_ACL, db->str, 0, 1, 0, + is_schema_db(db->str, db->length))) break; if (thd->locked_tables || thd->active_transaction()) { @@ -3997,7 +4003,8 @@ end_with_restore_list: first_table ? &first_table->grant.privilege : 0, first_table ? 0 : 1, 0, first_table ? (bool) first_table->schema_table : - select_lex->db ? is_schema_db(select_lex->db) : 0)) + select_lex->db ? + is_schema_db(select_lex->db) : 0)) goto error; if (thd->security_ctx->user) // If not replication @@ -4340,7 +4347,8 @@ end_with_restore_list: } if (check_access(thd, CREATE_PROC_ACL, lex->sphead->m_db.str, 0, 0, 0, - is_schema_db(lex->sphead->m_db.str))) + is_schema_db(lex->sphead->m_db.str, + lex->sphead->m_db.length))) goto create_sp_error; if (end_active_trans(thd)) @@ -6502,8 +6510,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, ptr->force_index= test(table_options & TL_OPTION_FORCE_INDEX); ptr->ignore_leaves= test(table_options & TL_OPTION_IGNORE_LEAVES); ptr->derived= table->sel; - if (!ptr->derived && !my_strcasecmp(system_charset_info, ptr->db, - INFORMATION_SCHEMA_NAME.str)) + if (!ptr->derived && is_schema_db(ptr->db, ptr->db_length)) { ST_SCHEMA_TABLE *schema_table; if (ptr->updating && @@ -7208,7 +7215,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables, /* If the query was killed then this function must fail. */ - return result || thd->killed; + return result || (thd ? thd->killed : 0); } diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 3ecc1c28288..c41d0d5d41e 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -3326,16 +3326,13 @@ int get_partition_id_range(partition_info *part_info, part_func_value-= 0x8000000000000000ULL; while (max_part_id > min_part_id) { - loc_part_id= (max_part_id + min_part_id + 1) >> 1; + loc_part_id= (max_part_id + min_part_id) / 2; if (range_array[loc_part_id] <= part_func_value) min_part_id= loc_part_id + 1; else - max_part_id= loc_part_id - 1; + max_part_id= loc_part_id; } loc_part_id= max_part_id; - if (part_func_value >= range_array[loc_part_id]) - if (loc_part_id != max_partition) - loc_part_id++; *part_id= (uint32)loc_part_id; if (loc_part_id == max_partition && part_func_value >= range_array[loc_part_id] && @@ -3409,6 +3406,7 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info, bool include_endpoint) { longlong *range_array= part_info->range_int_array; + longlong part_end_val; uint max_partition= part_info->num_parts - 1; uint min_part_id= 0, max_part_id= max_partition, loc_part_id; /* Get the partitioning function value for the endpoint */ @@ -3442,46 +3440,45 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info, } } - if (unsigned_flag) part_func_value-= 0x8000000000000000ULL; if (left_endpoint && !include_endpoint) part_func_value++; + + /* + Search for the partition containing part_func_value + (including the right endpoint). + */ while (max_part_id > min_part_id) { - loc_part_id= (max_part_id + min_part_id + 1) >> 1; - if (range_array[loc_part_id] <= part_func_value) + loc_part_id= (max_part_id + min_part_id) / 2; + if (range_array[loc_part_id] < part_func_value) min_part_id= loc_part_id + 1; else - max_part_id= loc_part_id - 1; + max_part_id= loc_part_id; } loc_part_id= max_part_id; - if (loc_part_id < max_partition && - part_func_value >= range_array[loc_part_id+1]) - { - loc_part_id++; - } + + /* Adjust for endpoints */ + part_end_val= range_array[loc_part_id]; if (left_endpoint) { - longlong bound= range_array[loc_part_id]; /* In case of PARTITION p VALUES LESS THAN MAXVALUE the maximum value is in the current partition. */ - if (part_func_value > bound || - (part_func_value == bound && - (!part_info->defined_max_value || loc_part_id < max_partition))) + if (part_func_value == part_end_val && + (loc_part_id < max_partition || !part_info->defined_max_value)) loc_part_id++; } else { - if (loc_part_id < max_partition) - { - if (part_func_value == range_array[loc_part_id]) - loc_part_id += test(include_endpoint); - else if (part_func_value > range_array[loc_part_id]) - loc_part_id++; - } + /* if 'WHERE <= X' and partition is LESS THAN (X) include next partition */ + if (include_endpoint && loc_part_id < max_partition && + part_func_value == part_end_val) + loc_part_id++; + + /* Right endpoint, set end after correct partition */ loc_part_id++; } DBUG_RETURN(loc_part_id); @@ -6043,8 +6040,7 @@ static bool write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt) part_info->first_log_entry= NULL; build_table_filename(path, sizeof(path) - 1, lpt->db, lpt->table_name, "", 0); - build_table_filename(tmp_path, sizeof(tmp_path) - 1, lpt->db, - lpt->table_name, "#", 0); + build_table_shadow_filename(tmp_path, sizeof(tmp_path) - 1, lpt); pthread_mutex_lock(&LOCK_gdl); if (write_log_dropped_partitions(lpt, &next_entry, (const char*)path, FALSE)) @@ -6100,8 +6096,7 @@ static bool write_log_add_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt) build_table_filename(path, sizeof(path) - 1, lpt->db, lpt->table_name, "", 0); - build_table_filename(tmp_path, sizeof(tmp_path) - 1, lpt->db, - lpt->table_name, "#", 0); + build_table_shadow_filename(tmp_path, sizeof(tmp_path) - 1, lpt); pthread_mutex_lock(&LOCK_gdl); if (write_log_dropped_partitions(lpt, &next_entry, (const char*)path, FALSE)) @@ -6326,7 +6321,7 @@ void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt, partition_info *part_info= lpt->part_info; DBUG_ENTER("handle_alter_part_error"); - if (!part_info->first_log_entry && + if (part_info->first_log_entry && execute_ddl_log_entry(current_thd, part_info->first_log_entry->entry_pos)) { diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 168934206e5..934b87a938f 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1674,6 +1674,8 @@ static bool mysql_test_create_table(Prepared_statement *stmt) { lex->link_first_table_back(create_table, link_to_local); create_table->create= TRUE; + /* Base table and temporary table are not in the same name space. */ + create_table->skip_temporary= true; } if (open_normal_and_derived_tables(stmt->thd, lex->query_tables, 0)) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index acdacdc611c..cb4a9b5943a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -946,6 +946,7 @@ JOIN::optimize() DBUG_PRINT("info",("Select tables optimized away")); zero_result_cause= "Select tables optimized away"; tables_list= 0; // All tables resolved + const_tables= tables; /* Extract all table-independent conditions and replace the WHERE clause with them. All other conditions were computed by opt_sum_query diff --git a/sql/sql_select.h b/sql/sql_select.h index e049e4ed765..a84fa65a548 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -718,6 +718,12 @@ public: my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set); int res= item->save_in_field(to_field, 1); + /* + Item::save_in_field() may call Item::val_xxx(). And if this is a subquery + we need to check for errors executing it and react accordingly + */ + if (!res && table->in_use->is_error()) + res= 2; dbug_tmp_restore_column_map(table->write_set, old_map); null_key= to_field->is_null() || item->null_value; return (err != 0 || res > 2 ? STORE_KEY_FATAL : (store_key_result) res); @@ -751,6 +757,12 @@ protected: if (!err) err= res; } + /* + Item::save_in_field() may call Item::val_xxx(). And if this is a subquery + we need to check for errors executing it and react accordingly + */ + if (!err && to_field->table->in_use->is_error()) + err= 2; } null_key= to_field->is_null() || item->null_value; return (err > 2 ? STORE_KEY_FATAL : (store_key_result) err); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index fb5ad32bed3..aa55b7728e4 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -748,8 +748,7 @@ bool mysqld_show_create_db(THD *thd, char *dbname, DBUG_RETURN(TRUE); } #endif - if (!my_strcasecmp(system_charset_info, dbname, - INFORMATION_SCHEMA_NAME.str)) + if (is_schema_db(dbname)) { dbname= INFORMATION_SCHEMA_NAME.str; create.default_table_charset= system_charset_info; @@ -2703,8 +2702,8 @@ int make_db_list(THD *thd, List<LEX_STRING> *files, */ if (lookup_field_vals->db_value.str) { - if (!my_strcasecmp(system_charset_info, INFORMATION_SCHEMA_NAME.str, - lookup_field_vals->db_value.str)) + if (is_schema_db(lookup_field_vals->db_value.str, + lookup_field_vals->db_value.length)) { *with_i_schema= 1; if (files->push_back(i_s_name_copy)) @@ -5333,7 +5332,7 @@ copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table) */ if (thd->lex->sql_command != SQLCOM_SHOW_EVENTS && check_access(thd, EVENT_ACL, et.dbname.str, 0, 0, 1, - is_schema_db(et.dbname.str))) + is_schema_db(et.dbname.str, et.dbname.length))) DBUG_RETURN(0); sch_table->field[ISE_EVENT_CATALOG]->store(STRING_WITH_LEN("def"), scs); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 17f4c89b7fb..25a2bf9df8c 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -647,7 +647,7 @@ static bool read_ddl_log_file_entry(uint entry_no) Write one entry from ddl log file SYNOPSIS write_ddl_log_file_entry() - entry_no Entry number to read + entry_no Entry number to write RETURN VALUES TRUE Error FALSE Success @@ -748,10 +748,10 @@ static uint read_ddl_log_header() else successful_open= TRUE; } - entry_no= uint4korr(&file_entry_buf[DDL_LOG_NUM_ENTRY_POS]); - global_ddl_log.name_len= uint4korr(&file_entry_buf[DDL_LOG_NAME_LEN_POS]); if (successful_open) { + entry_no= uint4korr(&file_entry_buf[DDL_LOG_NUM_ENTRY_POS]); + global_ddl_log.name_len= uint4korr(&file_entry_buf[DDL_LOG_NAME_LEN_POS]); global_ddl_log.io_size= uint4korr(&file_entry_buf[DDL_LOG_IO_SIZE_POS]); DBUG_ASSERT(global_ddl_log.io_size <= sizeof(global_ddl_log.file_entry_buf)); @@ -832,6 +832,7 @@ static bool init_ddl_log() goto end; global_ddl_log.io_size= IO_SIZE; + global_ddl_log.name_len= FN_LEN; create_ddl_log_file_name(file_name); if ((global_ddl_log.file_id= my_create(file_name, CREATE_MODE, @@ -884,6 +885,13 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry) { DBUG_RETURN(FALSE); } + DBUG_PRINT("ddl_log", + ("execute type %c next %u name '%s' from_name '%s' handler '%s'", + ddl_log_entry->action_type, + ddl_log_entry->next_entry, + ddl_log_entry->name, + ddl_log_entry->from_name, + ddl_log_entry->handler_name)); handler_name.str= (char*)ddl_log_entry->handler_name; handler_name.length= strlen(ddl_log_entry->handler_name); init_sql_alloc(&mem_root, TABLE_ALLOC_BLOCK_SIZE, 0); @@ -1091,6 +1099,15 @@ bool write_ddl_log_entry(DDL_LOG_ENTRY *ddl_log_entry, DBUG_RETURN(TRUE); } error= FALSE; + DBUG_PRINT("ddl_log", + ("write type %c next %u name '%s' from_name '%s' handler '%s'", + (char) global_ddl_log.file_entry_buf[DDL_LOG_ACTION_TYPE_POS], + ddl_log_entry->next_entry, + (char*) &global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS], + (char*) &global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS + + FN_LEN], + (char*) &global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS + + (2*FN_LEN)])); if (write_ddl_log_file_entry((*active_entry)->entry_pos)) { error= TRUE; diff --git a/sql/sql_view.cc b/sql/sql_view.cc index e9729d9e091..98952077573 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -268,11 +268,11 @@ bool create_view_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *view, table (i.e. user will not get some privileges by view creation) */ if ((check_access(thd, CREATE_VIEW_ACL, view->db, &view->grant.privilege, - 0, 0, is_schema_db(view->db)) || + 0, 0, is_schema_db(view->db, view->db_length)) || check_grant(thd, CREATE_VIEW_ACL, view, FALSE, 1, FALSE)) || (mode != VIEW_CREATE_NEW && (check_access(thd, DROP_ACL, view->db, &view->grant.privilege, - 0, 0, is_schema_db(view->db)) || + 0, 0, is_schema_db(view->db, view->db_length)) || check_grant(thd, DROP_ACL, view, FALSE, 1, FALSE)))) goto err; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index eba59b10879..36a910b7a99 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -9282,25 +9282,24 @@ interval: ; interval_time_stamp: - interval_time_st {} - | FRAC_SECOND_SYM - { - $$=INTERVAL_MICROSECOND; - /* - FRAC_SECOND was mistakenly implemented with - a wrong resolution. According to the ODBC - standard it should be nanoseconds, not - microseconds. Changing it to nanoseconds - in MySQL would mean making TIMESTAMPDIFF - and TIMESTAMPADD to return DECIMAL, since - the return value would be too big for BIGINT - Hence we just deprecate the incorrect - implementation without changing its - resolution. - */ - WARN_DEPRECATED(yythd, "6.2", "FRAC_SECOND", "MICROSECOND"); - } - ; + interval_time_st {} + | FRAC_SECOND_SYM { + $$=INTERVAL_MICROSECOND; + /* + FRAC_SECOND was mistakenly implemented with + a wrong resolution. According to the ODBC + standard it should be nanoseconds, not + microseconds. Changing it to nanoseconds + in MySQL would mean making TIMESTAMPDIFF + and TIMESTAMPADD to return DECIMAL, since + the return value would be too big for BIGINT + Hence we just deprecate the incorrect + implementation without changing its + resolution. + */ + WARN_DEPRECATED(yythd, VER_CELOSIA, "FRAC_SECOND", "MICROSECOND"); + } + ; interval_time_st: DAY_SYM { $$=INTERVAL_DAY; } diff --git a/sql/table.cc b/sql/table.cc index a1a422028d4..6841efee54e 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -212,10 +212,7 @@ TABLE_CATEGORY get_table_category(const LEX_STRING *db, const LEX_STRING *name) DBUG_ASSERT(db != NULL); DBUG_ASSERT(name != NULL); - if ((db->length == INFORMATION_SCHEMA_NAME.length) && - (my_strcasecmp(system_charset_info, - INFORMATION_SCHEMA_NAME.str, - db->str) == 0)) + if (is_schema_db(db->str, db->length)) { return TABLE_CATEGORY_INFORMATION; } |