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

Unclear error message when dropping a period defined using WITHOUT OVERLAPS

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.6
    • 10.6
    • Versioned Tables
    • None

    Description

      When dropping a period for an application-time period table defined using WITHOUT OVERLAPS, the associated index must be dropped as part of the same operation. If the index is not dropped, the operation results in an error.

      This behavior probably makes sense, but the current error message is not very clear:

      MariaDB [test]> ALTER TABLE coupons_wo_overlaps
          ->    DROP PERIOD FOR valid_period;
      ERROR 4156 (HY000): Period `valid_period` is not found in table
      

      I would think that a better error message might be something like:

      Period %s cannot be dropped from table unless index %s is dropped

      To reproduce:

      CREATE TABLE coupons_wo_overlaps (
         id SERIAL PRIMARY KEY,
         name VARCHAR(255),
         type ENUM('Monthly Special', 'Seasonal Sale') DEFAULT 'Monthly Special',
         code VARCHAR(255),
         date_start DATETIME,
         date_end DATETIME,
         PERIOD FOR valid_period(date_start, date_end),
         UNIQUE KEY (name, valid_period WITHOUT OVERLAPS)
      );
       
      SHOW CREATE TABLE coupons_wo_overlaps\G
       
      ALTER TABLE coupons_wo_overlaps
         DROP PERIOD FOR valid_period;
         
      ALTER TABLE coupons_wo_overlaps
         DROP PERIOD FOR valid_period,
         DROP INDEX name;
      

      Attachments

        Issue Links

          Activity

            People

              nikitamalyavin Nikita Malyavin
              GeoffMontee Geoff Montee (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.