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

Unusable key notes do not get reported for IN on data types mismatch

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.6, 11.6(EOL)
    • 10.6
    • Data types, Optimizer
    • None

    Description

      SET @@note_verbosity='all';
      CREATE OR REPLACE TABLE t1 (f CHAR(8) CHARACTER SET latin1, KEY(f));
      INSERT INTO t1 VALUES (''),('');
      SELECT * FROM t1 WHERE f IN ('a',3);
      SHOW WARNINGS;
      

      +---------+------+---------------------------------------+
      | Level   | Code | Message                               |
      +---------+------+---------------------------------------+
      | Warning | 1292 | Truncated incorrect DECIMAL value: '' |
      | Warning | 1292 | Truncated incorrect DECIMAL value: '' |
      +---------+------+---------------------------------------+
      

      Notice, there is no a warning about the data type problem for the pair (f,3).
      The expected behavior would be to report the data type mismatch for this pair.

      If I change replace the 3 to a string literal with a COLLATE clause, it correctly reports the collation mismatch for this pair:

      SELECT * FROM t1 WHERE f IN ('a',_latin1'b' COLLATE latin1_german2_ci);
      SHOW WARNINGS;
      

      +---------+------+--------------------------------------------------------------------------------------------+
      | Level   | Code | Message                                                                                    |
      +---------+------+--------------------------------------------------------------------------------------------+
      | Note    | 1105 | Cannot use key `f` part[0] for lookup: `test`.`t1`.`f` of type `char` >= "3" of type `int` |
      | Warning | 1292 | Truncated incorrect DOUBLE value: ''                                                       |
      | Warning | 1292 | Truncated incorrect DOUBLE value: 'a'                                                      |
      | Warning | 1292 | Truncated incorrect DOUBLE value: ''                                                       |
      | Warning | 1292 | Truncated incorrect DOUBLE value: 'a'                                                      |
      +---------+------+--------------------------------------------------------------------------------------------+
      

      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:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.