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

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.4, 10.5
    • Fix Version/s: 10.5.4, 10.4.14
    • Component/s: Server
    • Labels:
      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

            Assignee:
            sachin.setiya.007 Sachin Setiya
            Reporter:
            sachin.setiya.007 Sachin Setiya
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: