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

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

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

            bar Alexander Barkov created issue -
            bar Alexander Barkov made changes -
            Field Original Value New Value
            bar Alexander Barkov made changes -
            Fix Version/s 11.4.2 [ 29633 ]
            Fix Version/s 11.5.1 [ 29634 ]
            Fix Version/s 10.5.26 [ 29832 ]
            Fix Version/s 10.6.19 [ 29833 ]
            Fix Version/s 10.11.9 [ 29834 ]
            Fix Version/s 11.1.6 [ 29835 ]
            Fix Version/s 11.2.5 [ 29836 ]
            Fix Version/s 10.4 [ 22408 ]
            Fix Version/s 11.4 [ 29301 ]
            bar Alexander Barkov made changes -
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]
            bar Alexander Barkov made changes -
            Assignee Alexander Barkov [ bar ]
            dbart Daniel Bartholomew made changes -
            Fix Version/s 11.4.3 [ 29837 ]
            Fix Version/s 11.5.2 [ 29838 ]
            Fix Version/s 11.4.2 [ 29633 ]
            Fix Version/s 11.5.1 [ 29634 ]

            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.