[MDEV-8844] Unreadable control characters printed as is in warnings Created: 2015-09-25  Updated: 2020-03-16  Resolved: 2019-12-06

Status: Closed
Project: MariaDB Server
Component/s: Character Sets
Affects Version/s: 10.0, 10.1
Fix Version/s: 10.5.1

Type: Bug Priority: Minor
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Sprint: 10.1.10, 10.1.11

 Description   

SELECT CAST(_latin1 0x01 AS INT);
SHOW WARNINGS;

returns this warning:

+---------+------+----------------------------------------+
| Level   | Code | Message                                |
+---------+------+----------------------------------------+
| Warning | 1292 | Truncated incorrect INTEGER value: '<garbage>�' |
+---------+------+----------------------------------------+

Notice, the unreadable control character 0x01 is printed as is. It should be escaped.



 Comments   
Comment by Alexander Barkov [ 2019-12-05 ]

Hi julien.fritsch, I need to adjust the patch to the latest sources first.

Comment by Alexander Barkov [ 2019-12-06 ]

As of version 10.5 the warning is better, but still not correct:

SELECT CAST(_latin1 X'c000c1' AS SIGNED);
SHOW WARNINGS;

+---------+------+-----------------------------------------+
| Level   | Code | Message                                 |
+---------+------+-----------------------------------------+
| Warning | 1292 | Truncated incorrect INTEGER value: 'À'  |
+---------+------+-----------------------------------------+

Notice, it breaks on the byte 0x00 and does not display the rest of the string.

Comment by Alexander Barkov [ 2019-12-06 ]

Control characters \t \r \n are displayed as is, which makes the output look not nice:

SELECT CAST(_latin1 X'c00ac1' AS SIGNED);
SHOW WARNINGS;

+---------+------+--------------------------------------------+
| Level   | Code | Message                                    |
+---------+------+--------------------------------------------+
| Warning | 1292 | Truncated incorrect INTEGER value: 'À
Á'   |
+---------+------+--------------------------------------------+

This can be fixed later, if needed, in a separate MDEV.

Generated at Thu Feb 08 07:30:13 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.