Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
N/A
-
None
Description
I am not setting it to critical 10.10v1 to avoid it blocking the release, but it would be good to look into this. Not only does it cause an untidy output with a long list of duplicate warnings, but also my concern is that it may indicate some redundancy in the way the function is executed.
bb-10.10-MDEV-25704 c33ed04b7e7 |
MariaDB [test]> select random_bytes(cast('x' as unsigned)+1); |
+---------------------------------------+ |
| random_bytes(cast('x' as unsigned)+1) | |
+---------------------------------------+ |
| � |
|
+---------------------------------------+ |
1 row in set, 5 warnings (0.000 sec) |
|
MariaDB [test]> show warnings;
|
+---------+------+----------------------------------------+ |
| Level | Code | Message | |
+---------+------+----------------------------------------+ |
| Warning | 1292 | Truncated incorrect INTEGER value: 'x' | |
| Warning | 1292 | Truncated incorrect INTEGER value: 'x' | |
| Warning | 1292 | Truncated incorrect INTEGER value: 'x' | |
| Warning | 1292 | Truncated incorrect INTEGER value: 'x' | |
| Warning | 1292 | Truncated incorrect INTEGER value: 'x' | |
+---------+------+----------------------------------------+ |
5 rows in set (0.000 sec) |
The CAST alone only produces one warning, as expected:
MariaDB [test]> select cast('x' as unsigned); |
+-----------------------+ |
| cast('x' as unsigned) | |
+-----------------------+ |
| 0 |
|
+-----------------------+ |
1 row in set, 1 warning (0.000 sec) |
|
MariaDB [test]> show warnings;
|
+---------+------+----------------------------------------+ |
| Level | Code | Message | |
+---------+------+----------------------------------------+ |
| Warning | 1292 | Truncated incorrect INTEGER value: 'x' | |
+---------+------+----------------------------------------+ |
1 row in set (0.000 sec) |
If random_bytes is replaced by another function, no extra warnings are produced (although I didn't try all functions, so maybe random_bytes is not unique in this sense):
MariaDB [test]> select ceil(cast('x' as unsigned)+1); |
+-------------------------------+ |
| ceil(cast('x' as unsigned)+1) | |
+-------------------------------+ |
| 1 |
|
+-------------------------------+ |
1 row in set, 1 warning (0.000 sec) |
|
MariaDB [test]> show warnings;
|
+---------+------+----------------------------------------+ |
| Level | Code | Message | |
+---------+------+----------------------------------------+ |
| Warning | 1292 | Truncated incorrect INTEGER value: 'x' | |
+---------+------+----------------------------------------+ |
1 row in set (0.000 sec) |
Attachments
Issue Links
- relates to
-
MDEV-25704 Add RANDOM_BYTES function
-
- Closed
-
Have brought the 5 warnings back to a standard 2 consistent with sha2 and format that also call args[x]->val_int() in ::fix_length_and_dec and ::val_str.
MariaDB [test]> select sha2('bbbbb', cast('x' as unsigned)+224);
+----------------------------------------------------------+
| sha2('bbbbb', cast('x' as unsigned)+224) |
+----------------------------------------------------------+
| abd54ed96011c648e7e012dfef1a9f3174b70c86de55d0840f2a576d |
+----------------------------------------------------------+
1 row in set, 2 warnings (21.758 sec)
MariaDB [test]> show warnings;
+---------+------+----------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------+
| Warning | 1292 | Truncated incorrect INTEGER value: 'x' |
| Warning | 1292 | Truncated incorrect INTEGER value: 'x' |
+---------+------+----------------------------------------+
2 rows in set (0.000 sec)
MariaDB [test]> select format(4, cast('x' as unsigned)+1);
+------------------------------------+
| format(4, cast('x' as unsigned)+1) |
+------------------------------------+
| 4.0 |
+------------------------------------+
1 row in set, 2 warnings (5.392 sec)
MariaDB [test]> show warnings;
+---------+------+----------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------+
| Warning | 1292 | Truncated incorrect INTEGER value: 'x' |
| Warning | 1292 | Truncated incorrect INTEGER value: 'x' |
+---------+------+----------------------------------------+
2 rows in set (0.000 sec)
Not a complete solution, but a little more palatable. I think I need a bit of advice how to avoid this in the Item hierarchy with caching or otherwise.