← Back to team overview

maria-developers team mailing list archive

Re: [Commits] 667d178: MDEV-14576 Include full name of object in message about incorrect value for column.

 

Hi, Alexey!

Looks ok. I didn't expect make_truncated_value_warning to be used that
much :(

Jusr one comment below:

On Nov 13, Alexey Botchkov wrote:
> revision-id: 667d1786a96a40ee5074c9f1b493c7cf05a85cca (mariadb-10.2.18-80-g667d178)
> parent(s): 59b87e75d04f0ed75256724c78f7fd7af2f96e9b
> committer: Alexey Botchkov
> timestamp: 2018-11-13 00:11:32 +0400
> message:
> 
> MDEV-14576 Include full name of object in message about incorrect value for column.
> 
> The error message modified.
> Then the TABLE_SHARE::error_table_name() implementation taken from 10.3,
>      to be used as a name of the table in this message.
> 
> diff --git a/sql/field.cc b/sql/field.cc
> index caa84dc..4cb6eb2 100644
> --- a/sql/field.cc
> +++ b/sql/field.cc
> @@ -2079,7 +2079,7 @@ bool Field_num::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
>    longlong nr= val_int();
>    bool neg= !(flags & UNSIGNED_FLAG) && nr < 0;
>    return int_to_datetime_with_warn(neg, neg ? -nr : nr, ltime, fuzzydate,
> -                                   field_name);
> +                                   table->s, field_name);

couldn't you just pass this instead of this->table->s and this->field_name ?

>  }
>  
>  
> diff --git a/sql/sql_class.cc b/sql/sql_class.cc
> index 71d5b80..8f8607d 100644
> --- a/sql/sql_class.cc
> +++ b/sql/sql_class.cc
> @@ -3009,6 +3009,10 @@ int select_export::send_data(List<Item> &items)
>        error_pos= copier.most_important_error_pos();
>        if (error_pos)
>        {
> +        /*
> +          TODO: 
> +             add new error message that will show user this printable_buff
> +
>          char printable_buff[32];
>          convert_to_printable(printable_buff, sizeof(printable_buff),
>                               error_pos, res->ptr() + res->length() - error_pos,
> @@ -3018,6 +3022,11 @@ int select_export::send_data(List<Item> &items)
>                              ER_THD(thd, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
>                              "string", printable_buff,
>                              item->name, static_cast<long>(row_count));
> +        */
> +        push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
> +                            ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
> +                            ER_THD(thd, WARN_DATA_TRUNCATED),
> +                            item->name, static_cast<long>(row_count));

Why not ER_TRUNCATED_WRONG_VALUE "Truncated incorrect %-.32s value: '%-.128s'" ?
Ah, it has no row number...

>        }
>        else if (copier.source_end_pos() < res->ptr() + res->length())
>        { 
Regards,
Sergei
Chief Architect MariaDB
and security@xxxxxxxxxxx