正在从utf8mb4_unicode_520_ci升级MariaDB归类

vfwfrxfs  于 2023-03-02  发布在  其他
关注(0)|答案(2)|浏览(93)

目前我用途:

  • utf8mb4数据库字符集。
  • utf8mb4_unicode_520_ci数据库排序规则。

我知道utf8mb4支持每个字符最多四个字节。我也知道Unicode是一个不断更新的标准。过去我认为utf8已经足够了,直到我的一些测试数据被损坏,吸取了教训。但是我很难理解字符集和排序规则的升级路径。
utf8mb4_unicode_520_ci数据库排序规则基于Unicode Collation Algorithm version 5.2.0。如果您导航到父目录,您将看到在键入此内容时列出的最高版本14.0。现在这些是Unicode * 标准 *,然后是受支持的MariaDB character sets and collations
我不确定什么时候每个字符4个字节的需求会被每个字符8个字节甚至16个字节所取代,所以这不仅仅是更新数据库排序的简单措施。另外,我在MariaDB的文档中没有看到任何比5.2.0版本更新的东西。
因此,简而言之,我的三个高度相关的问题是:

  • 较新的归类(如版本14)是否仍然与四字节字符完全兼容,或者它们是否已经用尽了所有组合,现在每个字符最多需要8或16个字节?
  • 关于Unicode版本,MariaDB支持的最新数据库排序规则是什么?
  • 关于第二个问题,MariaDB支持比5.2.0更新的版本,那么utf8mb4是否仍然足够用于字符集?

我不受MySQL兼容性的约束,也不关心MySQL兼容性。

7lrncoxx

7lrncoxx1#

您可以检查MariaDB示例当前支持的排序规则:

SELECT * FROM INFORMATION_SCHEMA.COLLATIONS
WHERE CHARACTER_SET_NAME = 'utf8mb4';

据我所知,MariaDB不支持任何比utf8_unicode_520ci更新的UTF-8排序规则版本,如果您尝试使用'900'版本,例如从MySQL导入元数据到MariaDB,you get errors
不存在8字节或16字节的UTF-8编码,UTF-8是一种每个字符使用1到4个字节的编码,不会超过这个数目。
MariaDB还支持utf 16和utf 32,但这两种类型都不支持每个字符使用4个以上的字节。Utf 16是可变长度的,每个字符使用一个或两个16位代码单元。Utf 32是固定宽度的,每个字符始终使用32位(4个字节)。

t9eec4r0

t9eec4r02#

跳过旧的5.2.0版本,MariaDB在MariaDB-10.10.2中添加了UCA-14.0.0排序规则,并且在MariaDB-10.11+版本中也可用。
14.0.0归类还包括不区分重音作为可选归类属性。
此版本还支持缩写。
名单如下:

MariaDB [(none)]> SELECT * FROM INFORMATION_SCHEMA.COLLATIONS where collation_name like 'uca1400_%';
+--------------------------------+--------------------+------+------------+-------------+---------+
| COLLATION_NAME                 | CHARACTER_SET_NAME | ID   | IS_DEFAULT | IS_COMPILED | SORTLEN |
+--------------------------------+--------------------+------+------------+-------------+---------+
| uca1400_ai_ci                  | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_ai_cs                  | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_as_ci                  | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_as_cs                  | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_nopad_ai_ci            | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_nopad_ai_cs            | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_nopad_as_ci            | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_nopad_as_cs            | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_icelandic_ai_ci        | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_icelandic_ai_cs        | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_icelandic_as_ci        | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_icelandic_as_cs        | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_icelandic_nopad_ai_ci  | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_icelandic_nopad_ai_cs  | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_icelandic_nopad_as_ci  | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_icelandic_nopad_as_cs  | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_latvian_ai_ci          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_latvian_ai_cs          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_latvian_as_ci          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_latvian_as_cs          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_latvian_nopad_ai_ci    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_latvian_nopad_ai_cs    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_latvian_nopad_as_ci    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_latvian_nopad_as_cs    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_romanian_ai_ci         | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_romanian_ai_cs         | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_romanian_as_ci         | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_romanian_as_cs         | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_romanian_nopad_ai_ci   | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_romanian_nopad_ai_cs   | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_romanian_nopad_as_ci   | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_romanian_nopad_as_cs   | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_slovenian_ai_ci        | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_slovenian_ai_cs        | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_slovenian_as_ci        | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_slovenian_as_cs        | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_slovenian_nopad_ai_ci  | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_slovenian_nopad_ai_cs  | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_slovenian_nopad_as_ci  | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_slovenian_nopad_as_cs  | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_polish_ai_ci           | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_polish_ai_cs           | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_polish_as_ci           | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_polish_as_cs           | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_polish_nopad_ai_ci     | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_polish_nopad_ai_cs     | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_polish_nopad_as_ci     | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_polish_nopad_as_cs     | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_estonian_ai_ci         | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_estonian_ai_cs         | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_estonian_as_ci         | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_estonian_as_cs         | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_estonian_nopad_ai_ci   | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_estonian_nopad_ai_cs   | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_estonian_nopad_as_ci   | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_estonian_nopad_as_cs   | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_spanish_ai_ci          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_spanish_ai_cs          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_spanish_as_ci          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_spanish_as_cs          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_spanish_nopad_ai_ci    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_spanish_nopad_ai_cs    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_spanish_nopad_as_ci    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_spanish_nopad_as_cs    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_swedish_ai_ci          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_swedish_ai_cs          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_swedish_as_ci          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_swedish_as_cs          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_swedish_nopad_ai_ci    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_swedish_nopad_ai_cs    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_swedish_nopad_as_ci    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_swedish_nopad_as_cs    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_turkish_ai_ci          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_turkish_ai_cs          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_turkish_as_ci          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_turkish_as_cs          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_turkish_nopad_ai_ci    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_turkish_nopad_ai_cs    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_turkish_nopad_as_ci    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_turkish_nopad_as_cs    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_czech_ai_ci            | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_czech_ai_cs            | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_czech_as_ci            | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_czech_as_cs            | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_czech_nopad_ai_ci      | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_czech_nopad_ai_cs      | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_czech_nopad_as_ci      | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_czech_nopad_as_cs      | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_danish_ai_ci           | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_danish_ai_cs           | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_danish_as_ci           | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_danish_as_cs           | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_danish_nopad_ai_ci     | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_danish_nopad_ai_cs     | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_danish_nopad_as_ci     | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_danish_nopad_as_cs     | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_lithuanian_ai_ci       | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_lithuanian_ai_cs       | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_lithuanian_as_ci       | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_lithuanian_as_cs       | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_lithuanian_nopad_ai_ci | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_lithuanian_nopad_ai_cs | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_lithuanian_nopad_as_ci | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_lithuanian_nopad_as_cs | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_slovak_ai_ci           | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_slovak_ai_cs           | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_slovak_as_ci           | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_slovak_as_cs           | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_slovak_nopad_ai_ci     | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_slovak_nopad_ai_cs     | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_slovak_nopad_as_ci     | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_slovak_nopad_as_cs     | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_spanish2_ai_ci         | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_spanish2_ai_cs         | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_spanish2_as_ci         | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_spanish2_as_cs         | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_spanish2_nopad_ai_ci   | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_spanish2_nopad_ai_cs   | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_spanish2_nopad_as_ci   | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_spanish2_nopad_as_cs   | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_roman_ai_ci            | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_roman_ai_cs            | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_roman_as_ci            | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_roman_as_cs            | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_roman_nopad_ai_ci      | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_roman_nopad_ai_cs      | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_roman_nopad_as_ci      | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_roman_nopad_as_cs      | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_persian_ai_ci          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_persian_ai_cs          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_persian_as_ci          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_persian_as_cs          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_persian_nopad_ai_ci    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_persian_nopad_ai_cs    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_persian_nopad_as_ci    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_persian_nopad_as_cs    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_esperanto_ai_ci        | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_esperanto_ai_cs        | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_esperanto_as_ci        | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_esperanto_as_cs        | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_esperanto_nopad_ai_ci  | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_esperanto_nopad_ai_cs  | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_esperanto_nopad_as_ci  | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_esperanto_nopad_as_cs  | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_hungarian_ai_ci        | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_hungarian_ai_cs        | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_hungarian_as_ci        | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_hungarian_as_cs        | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_hungarian_nopad_ai_ci  | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_hungarian_nopad_ai_cs  | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_hungarian_nopad_as_ci  | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_hungarian_nopad_as_cs  | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_sinhala_ai_ci          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_sinhala_ai_cs          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_sinhala_as_ci          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_sinhala_as_cs          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_sinhala_nopad_ai_ci    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_sinhala_nopad_ai_cs    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_sinhala_nopad_as_ci    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_sinhala_nopad_as_cs    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_german2_ai_ci          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_german2_ai_cs          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_german2_as_ci          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_german2_as_cs          | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_german2_nopad_ai_ci    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_german2_nopad_ai_cs    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_german2_nopad_as_ci    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_german2_nopad_as_cs    | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_vietnamese_ai_ci       | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_vietnamese_ai_cs       | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_vietnamese_as_ci       | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_vietnamese_as_cs       | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_vietnamese_nopad_ai_ci | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_vietnamese_nopad_ai_cs | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_vietnamese_nopad_as_ci | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_vietnamese_nopad_as_cs | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_croatian_ai_ci         | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_croatian_ai_cs         | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_croatian_as_ci         | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_croatian_as_cs         | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_croatian_nopad_ai_ci   | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_croatian_nopad_ai_cs   | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_croatian_nopad_as_ci   | NULL               | NULL | NULL       | Yes         |       8 |
| uca1400_croatian_nopad_as_cs   | NULL               | NULL | NULL       | Yes         |       8 |
+--------------------------------+--------------------+------+------------+-------------+---------+
184 rows in set (0.001 sec)

参考:MDEV-27009

相关问题