Updated on 2025-10-23 GMT+08:00

character_sets

The character_sets view provides information about available character sets. This view is read-only. All users have the read permission on this view.

Table 1 information_schema.character_sets columns

Name

Type

Description

CHARACTER_SET_NAME

varchar(32)

Name of a character set.

DEFAULT_COLLATE_NAME

varchar(32)

Default collation for the character set.

DESCRIPTION

varchar(60)

Default collation used by the character set.

MAXLEN

bigint

Maximum number of bytes required to store a character.

The control behavior of the GUC parameter m_format_dev_version is forward compatible. When m_format_dev_version is set to s2, the latest function can be used. When m_format_dev_version is set to other values, forward compatibility is retained.

If the value of m_format_dev_version is not s2, the view displays only the character set information of the current database.

m_db=# SET m_format_dev_version=s1;
SET
m_db=# SELECT * FROM information_schema.character_sets;
 CHARACTER_SET_NAME | DEFAULT_COLLATE_NAME |         DESCRIPTION          | MAXLEN
--------------------+----------------------+------------------------------+--------
 UTF8               | utf8mb4_general_ci   | utf8mb4_general_ci collation |      4
(1 row)

If m_format_dev_version is set to s2, you can query the information about all available character sets in the view.

m_db=# SET m_format_dev_version=s2;
SET
m_db=# SELECT * FROM information_schema.character_sets;
 CHARACTER_SET_NAME | DEFAULT_COLLATE_NAME |         DESCRIPTION          | MAXLEN
--------------------+----------------------+------------------------------+--------
 binary             | binary               | binary collation             |      1
 gbk                | gbk_chinese_ci       | gbk_chinese_ci collation     |      2
 utf8mb4            | utf8mb4_general_ci   | utf8mb4_general_ci collation |      4
 gb18030            | gb18030_chinese_ci   | gb18030_chinese_ci collation |      4
 latin1             | latin1_swedish_ci    | latin1_swedish_ci collation  |      1
(5 rows)