MariaDB select 错误的 unicode 字符
MariaDB select wrong unicode character
插入 table_name
(col_name
) 值 ('');
SELECT * 来自 table_name
WHERE col_name
= '';
我认为第二个查询不必返回任何行,但会返回。
table 是 utf8mb4,排序规则 utf8mb4_unicode_ci。
与ci有关吗?我想保留它。
SELECT '' = '' COLLATE utf8mb4_unicode_ci,
'' = '' COLLATE utf8mb4_unicode_520_ci;
产量 1 和 0。
也就是说,utf8mb4_unicode_ci
将Emoji视为平等,但utf8mb4_unicode_520_ci
将它们视为不同。
因此,将 col_name
的排序规则更改为 utf8mb4_unicode_520_ci
。
插入 table_name
(col_name
) 值 ('');
SELECT * 来自 table_name
WHERE col_name
= '';
我认为第二个查询不必返回任何行,但会返回。
table 是 utf8mb4,排序规则 utf8mb4_unicode_ci。
与ci有关吗?我想保留它。
SELECT '' = '' COLLATE utf8mb4_unicode_ci,
'' = '' COLLATE utf8mb4_unicode_520_ci;
产量 1 和 0。
也就是说,utf8mb4_unicode_ci
将Emoji视为平等,但utf8mb4_unicode_520_ci
将它们视为不同。
因此,将 col_name
的排序规则更改为 utf8mb4_unicode_520_ci
。