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

Long unique keys are not created when individual key_part->length < max_key_length but SUM(key_parts->length) > max_key_length

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.4, 10.5
    • 10.5.4, 10.4.14
    • Server
    • None

    Description

      --source include/have_innodb.inc
      CREATE TABLE t1 (a int, b VARCHAR(1000), UNIQUE (a,b)) ENGINE=MyISAM;
      show index from t1;
       
      # Cleanup
      DROP TABLE t1;
      

      CREATE TABLE t1 (a int, b VARCHAR(1000), UNIQUE (a,b)) ENGINE=MyISAM;
      main.xyz 'innodb'                 [ fail ]
              Test ended at 2020-05-26 18:39:24
       
      CURRENT_TEST: main.mdev_21834
      mysqltest: At line 2: query 'CREATE TABLE t1 (a int, b VARCHAR(1000), UNIQUE (a,b)) ENGINE=MyISAM' failed: 1071: Specified key was too long; max key length is 1000 bytes
       
      
      

      If I increase the varchar size > 1000 (will create HASH index) or < 997(Will create BTREE index)

      Attachments

        Activity

          People

            sachin.setiya.007 Sachin Setiya (Inactive)
            sachin.setiya.007 Sachin Setiya (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.