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

HANDLER commands are case insensitive with lower-case-table-names=0

    XMLWordPrintable

Details

    Description

      I execute this SQL script with a Linux MariaDB server running with --lower-case-table-names=0:

      CREATE OR REPLACE TABLE t1 (a INT);
      INSERT INTO t1 VALUES (1),(2);
      HANDLER t1 OPEN;
      HANDLER t1 READ FIRST;
      CREATE OR REPLACE TABLE T1 (a INT);
      DROP TABLE T1;
      HANDLER t1 READ NEXT;
      

      ERROR 1109 (42S02): Unknown table 't1' in HANDLER
      

      The above looks wrong. This command should return the second record from `t1`.

      The problem is in this code fragment in mysql_ha_find_match() in sql_handler.cc:

            if ((! tables->db.str[0] ||
                ! my_strcasecmp(&my_charset_latin1, hash_tables->db.str,
                                tables->get_db_name())) &&
                ! my_strcasecmp(&my_charset_latin1, hash_tables->table_name.str,
                                tables->get_table_name()))
      

      It compares table and db names in case insensitive style. Also, it erroneously uses latin1 as a character set.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.