Description:
If the value of `num' parameter in CONV() function is larger than ULONG_MAX, then MySQL:
5.7)
silently truncates the value,
8)
truncates the value and report a warning.
Moreover, that's also true for other operations like bitwise-and for example, however in this case both 5.7 and 8.0 return a warning.
How to repeat:
5.7)
mysql> select conv('18446744073709551615',10,16);
+------------------------------------+
| conv('18446744073709551615',10,16) |
+------------------------------------+
| FFFFFFFFFFFFFFFF |
+------------------------------------+
1 row in set (0.00 sec)
mysql> select conv('18446744073709551616',10,16);
+------------------------------------+
| conv('18446744073709551616',10,16) |
+------------------------------------+
| FFFFFFFFFFFFFFFF |
+------------------------------------+
1 row in set (0.00 sec)
mysql> select conv('18446744073709551620',10,16);
+------------------------------------+
| conv('18446744073709551620',10,16) |
+------------------------------------+
| FFFFFFFFFFFFFFFF |
+------------------------------------+
1 row in set (0.00 sec)
8)
mysql [localhost:8015] {msandbox} ((none)) > select conv('18446744073709551615',10,16);
+------------------------------------+
| conv('18446744073709551615',10,16) |
+------------------------------------+
| FFFFFFFFFFFFFFFF |
+------------------------------------+
1 row in set (0.00 sec)
mysql [localhost:8015] {msandbox} ((none)) > select conv('18446744073709551616',10,16);
+------------------------------------+
| conv('18446744073709551616',10,16) |
+------------------------------------+
| FFFFFFFFFFFFFFFF |
+------------------------------------+
1 row in set, 1 warning (0.00 sec)
mysql [localhost:8015] {msandbox} ((none)) > select conv('18446744073709551620',10,16);
+------------------------------------+
| conv('18446744073709551620',10,16) |
+------------------------------------+
| FFFFFFFFFFFFFFFF |
+------------------------------------+
1 row in set, 1 warning (0.00 sec)
mysql [localhost:8015] {msandbox} ((none)) > select 18446744073709551620 & 18446744073709551620;
+----------------------------------------------+
| 18446744073709551620 & 18446744073709551620 |
+----------------------------------------------+
| 9223372036854775807 |
+----------------------------------------------+
Suggested fix:
Return NULL and warning.
Description: If the value of `num' parameter in CONV() function is larger than ULONG_MAX, then MySQL: 5.7) silently truncates the value, 8) truncates the value and report a warning. Moreover, that's also true for other operations like bitwise-and for example, however in this case both 5.7 and 8.0 return a warning. How to repeat: 5.7) mysql> select conv('18446744073709551615',10,16); +------------------------------------+ | conv('18446744073709551615',10,16) | +------------------------------------+ | FFFFFFFFFFFFFFFF | +------------------------------------+ 1 row in set (0.00 sec) mysql> select conv('18446744073709551616',10,16); +------------------------------------+ | conv('18446744073709551616',10,16) | +------------------------------------+ | FFFFFFFFFFFFFFFF | +------------------------------------+ 1 row in set (0.00 sec) mysql> select conv('18446744073709551620',10,16); +------------------------------------+ | conv('18446744073709551620',10,16) | +------------------------------------+ | FFFFFFFFFFFFFFFF | +------------------------------------+ 1 row in set (0.00 sec) 8) mysql [localhost:8015] {msandbox} ((none)) > select conv('18446744073709551615',10,16); +------------------------------------+ | conv('18446744073709551615',10,16) | +------------------------------------+ | FFFFFFFFFFFFFFFF | +------------------------------------+ 1 row in set (0.00 sec) mysql [localhost:8015] {msandbox} ((none)) > select conv('18446744073709551616',10,16); +------------------------------------+ | conv('18446744073709551616',10,16) | +------------------------------------+ | FFFFFFFFFFFFFFFF | +------------------------------------+ 1 row in set, 1 warning (0.00 sec) mysql [localhost:8015] {msandbox} ((none)) > select conv('18446744073709551620',10,16); +------------------------------------+ | conv('18446744073709551620',10,16) | +------------------------------------+ | FFFFFFFFFFFFFFFF | +------------------------------------+ 1 row in set, 1 warning (0.00 sec) mysql [localhost:8015] {msandbox} ((none)) > select 18446744073709551620 & 18446744073709551620; +----------------------------------------------+ | 18446744073709551620 & 18446744073709551620 | +----------------------------------------------+ | 9223372036854775807 | +----------------------------------------------+ Suggested fix: Return NULL and warning.