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

Silent varchar(255) key size truncation to 250

    XMLWordPrintable

Details

    Description

      10.3.11-MariaDB-1 Debian buildd-unstable
       
      MariaDB [st_forum]> create table test (a varchar(255), key(a)) engine = myisam;
      Query OK, 0 rows affected, 1 warning (0.005 sec)
       
      MariaDB [st_forum]> show create table test;
      +-------+---------------------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                                        |
      +-------+---------------------------------------------------------------------------------------------------------------------+
      | test  | CREATE TABLE `test` (
        `a` varchar(255) DEFAULT NULL,
        KEY `a` (`a`(250))
      ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 |
      +-------+---------------------------------------------------------------------------------------------------------------------+
      1 row in set (0.001 sec)
      
      

      Update:
      OK, not entirely silent apparently.. but warnings are nearly invisible.
      varchar(255) is a common type.. why is it no longer possible to create indexes on it?

      The warning / error also seems to be inconsistent, in alter table convert charset it appears to be an error.
      IMO it should always be an error.

      MariaDB [st_forum]> show warnings;  
      +---------+------+----------------------------------------------------------+
      | Level   | Code | Message                                                  |
      +---------+------+----------------------------------------------------------+
      | Warning | 1071 | Specified key was too long; max key length is 1000 bytes |
      +---------+------+----------------------------------------------------------+
      1 row in set (0.000 sec)
      

      Attachments

        Activity

          People

            serg Sergei Golubchik
            XTF Olaf van der Spek
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.