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

@ -991,20 +991,20 @@ CALL spxml('<a><b>b1</b><b>b2</b></a>', '1 and string');
ExtractValue(xml,'/a/b[$i]')
b1
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '1 and string '
Warning 1292 Truncated incorrect INTEGER value: '1 and string '
Warning 1292 Truncated incorrect INTEGER value: '1 and string'
Warning 1292 Truncated incorrect INTEGER value: '1 and string'
CALL spxml('<a><b>b1</b><b>b2</b></a>', 'string and 1');
ExtractValue(xml,'/a/b[$i]')
Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'string and 1 '
Warning 1292 Truncated incorrect INTEGER value: 'string and 1 '
Warning 1292 Truncated incorrect INTEGER value: 'string and 1'
Warning 1292 Truncated incorrect INTEGER value: 'string and 1'
CALL spxml('<a><b>b1</b><b>b2</b></a>', 'string');
ExtractValue(xml,'/a/b[$i]')
Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'string '
Warning 1292 Truncated incorrect INTEGER value: 'string '
Warning 1292 Truncated incorrect INTEGER value: 'string'
Warning 1292 Truncated incorrect INTEGER value: 'string'
DROP PROCEDURE spxml;
select UpdateXML('<a>a</a>',repeat('a b ',1000),'');
ERROR HY000: XPATH syntax error: 'b a b a b a b a b a b a b a b...'