Skip to content

value end with space's unique check doesn't works when columns be non-utf8 collation + prefix column index #24569

@lysu

Description

@lysu

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table zz (x varchar(40) CHARACTER SET ascii COLLATE ascii_bin, UNIQUE KEY `uk`(`x`(4)));
insert into zz select 'abc ';
insert into zz select 'abc d';

2. What did you expect to see? (Required)

insert into zz select 'abc d';
mysql> insert into zz select 'abc d';
ERROR 1062 (23000): Duplicate entry 'abc ' for key 'uk'

3. What did you see instead (Required)

mysql> insert into zz select 'abc d';
Query OK, 1 row affected (0.01 sec)
Records: 1  Duplicates: 0  Warnings: 0

4. What is your TiDB version? (Required)

5.0.0, 5.0.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions