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

Different warnings with and without index on WHERE varchar_column='bad_byte_sequence'

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.1, 10.0, 5.5
    • Fix Version/s: 10.1
    • Component/s: Character Sets
    • Labels:
      None

      Description

      If I run this script with a bad byte sequence (notice '😎' is a valid 4-byte utf8mb4 character, but it's not a valid for 3-byte utf8):

      SET NAMES utf8;
      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8, KEY(a)) ENGINE=MyISAM;
      INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'),('e');
      SELECT * FROM t1 WHERE a='😎';
      SHOW WARNINGS;
      

      it returns empty set with a warning:

      +---------+------+--------------------------------------------------------------------+
      | Level   | Code | Message                                                            |
      +---------+------+--------------------------------------------------------------------+
      | Warning | 1366 | Incorrect string value: '\xF0\x9F\x98\x8E' for column 'a' at row 1 |
      +---------+------+--------------------------------------------------------------------+
      

      Now if I drop the index and re-run the SELECT query:

      ALTER TABLE t1 DROP KEY a;
      SELECT * FROM t1 WHERE a='😎';
      SHOW WARNINGS;
      

      it still returns empty set but without any warning.

      It should be fixed to produce the same warnings with and without indexes.
      Preferably, one warning in both cases.

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

              • Assignee:
                bar Alexander Barkov
                Reporter:
                bar Alexander Barkov
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: