Description:
mysql> select collation('1e100');
+--------------------+
| collation('1e100') |
+--------------------+
| utf8mb4_general_ci |
+--------------------+
1 row in set (0.00 sec)
mysql> select collation(1e100);
+------------------+
| collation(1e100) |
+------------------+
| binary |
+------------------+
1 row in set (0.00 sec)
while, here comes the problem:
mysql> select strcmp('1e100', 1e100);
+------------------------+
| strcmp('1e100', 1e100) |
+------------------------+
| 0 |
+------------------------+
1 row in set (0.00 sec)
mysql> select strcmp('1E100', 1e100);
+------------------------+
| strcmp('1E100', 1e100) |
+------------------------+
| -1 |
+------------------------+
1 row in set (0.00 sec)
we can make a reasonable deduction that mysql uses collation utf8mb4_bin to compare them which is not reasonable
BTW, I found that mariadb gives a reasonable result:
mariadb> select strcmp('1e100', 1e100);
+------------------------+
| strcmp('1e100', 1e100) |
+------------------------+
| 0 |
+------------------------+
1 row in set (0.00 sec)
mariadb> select strcmp('1E100', 1e100);
+------------------------+
| strcmp('1E100', 1e100) |
+------------------------+
| 0 |
+------------------------+
1 row in set (0.00 sec)
How to repeat:
select strcmp('1e100', 1e100);
select strcmp('1E100', 1e100);
Suggested fix:
strcmp('1E100', 1e100) returns 0 rather than -1