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

Wrong I_S.COLUMNS.CHARACTER_XXX_LENGTH value for compressed columns

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.3
    • Fix Version/s: 10.3.7
    • Component/s: Data types
    • Labels:
      None

      Description

      This script queries I_S for a latin1 compressed varchar column:

      CREATE OR REPLACE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1 COMPRESSED);
      SELECT
        CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH
      FROM
        INFORMATION_SCHEMA.COLUMNS
      WHERE
        TABLE_SCHEMA='test' AND TABLE_NAME='t1' AND COLUMN_NAME='a';
      

      +--------------------------+------------------------+
      | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH |
      +--------------------------+------------------------+
      |                       11 |                     11 |
      +--------------------------+------------------------+
      

      11 looks wrong. The expected value would be 10 for both columns.

      Now trying an utf8 column:

      CREATE OR REPLACE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COMPRESSED);
      SELECT
        CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH
      FROM
        INFORMATION_SCHEMA.COLUMNS
      WHERE
        TABLE_SCHEMA='test' AND TABLE_NAME='t1' AND COLUMN_NAME='a';
      

      +--------------------------+------------------------+
      | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH |
      +--------------------------+------------------------+
      |                       10 |                     31 |
      +--------------------------+------------------------+
      

      The value for CHARACTER_OCTET_LENGTH is wrong. The expected result is 30.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bar Alexander Barkov
              Reporter:
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: