显然是一个非常罕见的问题,但 IMO 非常烦人和错误:相比之下,MySQL 中没有使用尾随空格:
mysql> SELECT "A" = "A ";
+------------+
| "A" = "A " |
+------------+
| 1 |
+------------+
1 row in set (0.00 sec)
这在以下情况下尤其成问题:
mysql> SELECT COUNT(*) FROM eq WHERE name != TRIM(name);
+------------+
| COUNT(*) |
+------------+
| 0 |
+------------+
1 row in set (0.00 sec)
mysql> UPDATE eq SET name=TRIM(name);
Query OK, 866 row affected (0.01 sec)
Rows matched: 650907 Changed: 866 Warnings: 0
有没有办法配置 MySQL 以正确处理空格?