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

information_schema.PARTITIONS shows a wrong PARTITION_DESCRIPTION for the DEFAULT partition of a LIST or LIST COLUMNS table

    XMLWordPrintable

Details

    Description

      Likely cause: MDEV-8348, which added the DEFAULT partition for LIST in CS 10.2.2. It made SHOW CREATE TABLE print DEFAULT for this partition, but not information_schema.PARTITIONS.

      --source include/have_partition.inc
      CREATE TABLE t1 (a INT) PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0), PARTITION p1 DEFAULT);
      --let $n= `SELECT COUNT(*) FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 't1' AND PARTITION_DESCRIPTION = '0'`
      if ($n != 1)
      {
        --die The DEFAULT partition of a LIST table has PARTITION_DESCRIPTION 0, the same as the partition with VALUES IN (0)
      }
      CREATE TABLE t2 (a INT) PARTITION BY LIST COLUMNS (a) (PARTITION p0 VALUES IN (1), PARTITION p1 DEFAULT);
      --let $n= `SELECT COUNT(*) FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 't2' AND PARTITION_DESCRIPTION LIKE '%MAXVALUE%'`
      if ($n)
      {
        --die The DEFAULT partition of a LIST COLUMNS table has PARTITION_DESCRIPTION MAXVALUE
      }
      DROP TABLE t1, t2;

      Leads to:

      CS 13.1.2 87e62ca17270e163a6d41b3fc8d6f4d440f1bb88 (Optimized, Clang 22.1.8-20260622) Build 05/10/2026

      mysqltest: At line 6: The DEFAULT partition of a LIST table has PARTITION_DESCRIPTION 0, the same as the partition with VALUES IN (0)

      For LIST, the DEFAULT partition shows 0, so a table with VALUES IN (0) and DEFAULT shows two partitions for the value 0. For LIST COLUMNS, it shows MAXVALUE, or (MAXVALUE,MAXVALUE) for two columns. SHOW CREATE TABLE shows DEFAULT. Debug builds give the same result.

      From the code it seems that the LIST part of information_schema.PARTITIONS in sql/sql_show.cc does not check the max_value flag of the partition, which SHOW CREATE TABLE checks to print DEFAULT.

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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