1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-34295 CAST(char_col AS DOUBLE) prints redundant spaces in a warning

Field_string::val_int(), Field_string::val_real(), Field_string::val_decimal()
passed the whole buffer of field_length bytes to data type conversion routines.
This made conversion routines to print redundant trailing spaces in case of warnings.

Adding a method Field_string::to_lex_cstring() and using it inside
val_int(), val_real(), val_decimal(), val_str().

After this change conversion routines get the same value with what val_str() returns,
and no redundant trailing spaces are displayed.
This commit is contained in:
Alexander Barkov
2024-06-04 15:06:37 +04:00
parent 581712b989
commit 5e12d49205
10 changed files with 118 additions and 52 deletions

View File

@ -4013,6 +4013,7 @@ class Field_string final :public Field_longstr {
field_length >= 4 &&
orig_table->s->frm_version < FRM_VER_TRUE_VARCHAR;
}
LEX_CSTRING to_lex_cstring() const;
public:
bool can_alter_field_type;
Field_string(uchar *ptr_arg, uint32 len_arg,uchar *null_ptr_arg,