Bug #103522 JSON_TABLE: Warning is not produced on truncation
Submitted: 28 Apr 2021 18:02 Modified: 29 Apr 2021 5:02
Reporter: Sergei Petrunia Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: JSON Severity:S3 (Non-critical)
Version:8.0.24 OS:Any
Assigned to: CPU Architecture:Any

[28 Apr 2021 18:02] Sergei Petrunia
Description:
https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html says

When a value saved to a column is truncated, such as saving 3.14159 in a DECIMAL(10,1) column, a warning is issued independently of any ON ERROR option. When multiple values are truncated in a single statement, the warning is issued only once.

The server doesn't produce a warning.

How to repeat:
mysql> set @json='
    '> [
    '>   {"col1":3.14159 }
    '> ]';
Query OK, 0 rows affected (0.00 sec)

mysql> 
mysql> select * from json_table(@json, '$[*]' 
    ->   columns(
    ->    col1 decimal(10,1) path '$.col1') 
    -> ) as jt;
+------+
| col1 |
+------+
|  3.1 |
+------+
1 row in set (0.00 sec)

No warnings.

Suggested fix:
I am not sure what should be fixed here - the code or the documentation, but one of them should be.
[28 Apr 2021 18:03] Sergei Petrunia
Editing the bug synopsis
[29 Apr 2021 5:02] MySQL Verification Team
Hello Sergei,

Thank you for the report and test case.
Verified as described.

regards,
Umesh