Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-36503

add Pad_attribute column to INFORMATION_SCHEMA.COLLATIONS

    XMLWordPrintable

Details

    • A new column PAD_ATTRIBUTE was been added to INFORMATION_SCHEMA.COLLATIONS and SHOW COLLATION that shows whether a collation is PAD SPACE or NOPAD.
    • Q2/2025 Development

    Description

      Add column to INFORMATION_SCHEMA.COLLATIONS that shows whether collation is PAD SPACE or NOPAD. For compatibility let's use same values and same column name as in MYSQL

      INFORMATION_SCHEMA.COLLATIONS

      Let's add the new column after SORTLEN (before COMMENT), so the new structure looks like this:

      MariaDB [test]> desc information_schema.collations;
      +--------------------+----------------------------+------+-----+---------+-------+
      | Field              | Type                       | Null | Key | Default | Extra |
      +--------------------+----------------------------+------+-----+---------+-------+
      | COLLATION_NAME     | varchar(64)                | NO   |     | NULL    |       |
      | CHARACTER_SET_NAME | varchar(32)                | YES  |     | NULL    |       |
      | ID                 | bigint(11)                 | YES  |     | NULL    |       |
      | IS_DEFAULT         | varchar(3)                 | YES  |     | NULL    |       |
      | IS_COMPILED        | varchar(3)                 | NO   |     | NULL    |       |
      | SORTLEN            | bigint(3)                  | NO   |     | NULL    |       |
      | PAD_ATTRIBUTE      | enum('PAD SPACE','NO PAD') | NO   |     | NULL    |       |
      | COMMENT            | varchar(80)                | NO   |     | NULL    |       |
      +--------------------+----------------------------+------+-----+---------+-------+
      

      The above order will be compatible with MySQL-8.0 order (with the exception that MariaDB has an extra last column COMMENT):

      +--------------------+----------------------------+------+-----+---------+-------+
      | Field              | Type                       | Null | Key | Default | Extra |
      +--------------------+----------------------------+------+-----+---------+-------+
      | COLLATION_NAME     | varchar(64)                | NO   |     | NULL    |       |
      | CHARACTER_SET_NAME | varchar(64)                | NO   |     | NULL    |       |
      | ID                 | bigint unsigned            | NO   |     | 0       |       |
      | IS_DEFAULT         | varchar(3)                 | NO   |     |         |       |
      | IS_COMPILED        | varchar(3)                 | NO   |     |         |       |
      | SORTLEN            | int unsigned               | NO   |     | NULL    |       |
      | PAD_ATTRIBUTE      | enum('PAD SPACE','NO PAD') | NO   |     | NULL    |       |
      +--------------------+----------------------------+------+-----+---------+-------+
      

      SHOW COLLATION

      Let's also add this new column to SHOW COLLATION as the last column, as follows:

      MariaDB [test]> show collation like 'utf8mb4_bin';
      +-------------+---------+------+---------+----------+---------+---------------+
      | Collation   | Charset | Id   | Default | Compiled | Sortlen | Pad_attribute |
      +-------------+---------+------+---------+----------+---------+---------------+
      | utf8mb4_bin | utf8mb4 |   46 |         | Yes      |       1 | PAD SPACE     |
      +-------------+---------+------+---------+----------+---------+---------------+
      

      This will be compatible with MySQL's SHOW COLLATION:

      +-------------+---------+----+---------+----------+---------+---------------+
      | Collation   | Charset | Id | Default | Compiled | Sortlen | Pad_attribute |
      +-------------+---------+----+---------+----------+---------+---------------+
      | utf8mb4_bin | utf8mb4 | 46 |         | Yes      |       1 | PAD SPACE     |
      +-------------+---------+----+---------+----------+---------+---------------+
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              serg Sergei Golubchik
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.