diff options
author | Nikita Malyavin <nikitamalyavin@gmail.com> | 2020-07-29 01:01:24 +1000 |
---|---|---|
committer | Nikita Malyavin <nikitamalyavin@gmail.com> | 2020-07-31 17:38:41 +1000 |
commit | fd0abc890f99e2b5ca1b8ae4cb0dc3968eef1208 (patch) | |
tree | e447f8d04288935cbaa44f70ac6fff2c465921db /sql/sql_time.cc | |
parent | 91ebf1844f4fbc36edb66023332a045895d07cf5 (diff) | |
download | mariadb-git-fd0abc890f99e2b5ca1b8ae4cb0dc3968eef1208.tar.gz |
MDEV-18042 Server crashes upon adding a non-null date column under NO_ZERO_DATE with ALGORITHM=INPLACE
accept table_name and db_name instead of table_share in make_truncated_value_warning
Diffstat (limited to 'sql/sql_time.cc')
-rw-r--r-- | sql/sql_time.cc | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/sql/sql_time.cc b/sql/sql_time.cc index a6fe937df4b..7f5919007e8 100644 --- a/sql/sql_time.cc +++ b/sql/sql_time.cc @@ -18,7 +18,6 @@ /* Functions to handle date and time */ #include <my_global.h> -#include "sql_priv.h" #include "sql_time.h" #include "tztime.h" // struct Time_zone #include "sql_class.h" // THD @@ -223,7 +222,7 @@ check_date_with_warn(const MYSQL_TIME *ltime, ulonglong fuzzy_date, { ErrConvTime str(ltime); make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, - &str, ts_type, 0, 0); + &str, ts_type, NULL, NULL, NULL); return true; } return false; @@ -240,7 +239,7 @@ adjust_time_range_with_warn(MYSQL_TIME *ltime, uint dec) return true; if (warnings) make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, - &str, MYSQL_TIMESTAMP_TIME, 0, NullS); + &str, MYSQL_TIMESTAMP_TIME, NULL, NULL, NULL); return false; } @@ -329,7 +328,8 @@ str_to_datetime_with_warn(CHARSET_INFO *cs, ret_val ? Sql_condition::WARN_LEVEL_WARN : Sql_condition::time_warn_level(status.warnings), str, length, flags & TIME_TIME_ONLY ? - MYSQL_TIMESTAMP_TIME : l_time->time_type, 0, NullS); + MYSQL_TIMESTAMP_TIME : l_time->time_type, + NULL, NULL, NULL); DBUG_EXECUTE_IF("str_to_datetime_warn", push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_YES, str);); @@ -387,7 +387,8 @@ static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part, Sql_condition::WARN_LEVEL_WARN, str, res < 0 ? MYSQL_TIMESTAMP_ERROR : mysql_type_to_time_type(f_type), - s, field_name); + s ? s->db.str : NULL, + s ? s->table_name.str : NULL, field_name); } return res < 0; } @@ -859,7 +860,8 @@ void make_truncated_value_warning(THD *thd, Sql_condition::enum_warning_level level, const ErrConv *sval, timestamp_type time_type, - const TABLE_SHARE *s, const char *field_name) + const char *db_name, const char *table_name, + const char *field_name) { char warn_buff[MYSQL_ERRMSG_SIZE]; const char *type_str; @@ -879,9 +881,6 @@ void make_truncated_value_warning(THD *thd, } if (field_name) { - const char *db_name= s->db.str; - const char *table_name= s->table_name.str; - if (!db_name) db_name= ""; if (!table_name) @@ -1219,7 +1218,7 @@ make_date_with_warn(MYSQL_TIME *ltime, ulonglong fuzzy_date, /* e.g. negative time */ ErrConvTime str(ltime); make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, - &str, ts_type, 0, 0); + &str, ts_type, NULL, NULL, NULL); return true; } if ((ltime->time_type= ts_type) == MYSQL_TIMESTAMP_DATE) @@ -1383,7 +1382,7 @@ time_to_datetime_with_warn(THD *thd, { ErrConvTime str(from); make_truncated_value_warning(thd, Sql_condition::WARN_LEVEL_WARN, - &str, MYSQL_TIMESTAMP_DATETIME, 0, 0); + &str, MYSQL_TIMESTAMP_DATETIME, NULL, NULL, NULL); return true; } return false; |