[MDEV-8636] Different warnings with and without index on WHERE varchar_column='bad_byte_sequence' Created: 2015-08-17  Updated: 2015-10-28

Status: Open
Project: MariaDB Server
Component/s: Character Sets
Affects Version/s: 5.5, 10.0, 10.1
Fix Version/s: 10.1

Type: Bug Priority: Minor
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Unresolved Votes: 0
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.


Generated at Thu Feb 08 07:28:39 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.