Bug #78441 Prefixed indexes not ignore by engine when unique or primary
Submitted: 15 Sep 2015 8:59 Modified: 8 Feb 2016 13:17
Reporter: Bruno ASTIER Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S2 (Serious)
Version:5.6.25-ndb-7.4.7-cluster-gpl OS:Any
Assigned to: CPU Architecture:Any

[15 Sep 2015 8:59] Bruno ASTIER
Description:
When creating a prefixed unique index (or a prefixed primary key), prefix is not ignored by engine.

If prefixed index is not unique then engine ignore prefix as it should.

How to repeat:
Working :
- create table t (c1 int not null, c2 varchar(500), index i1 (c2(50))) engine=ndb; 
- create index i2 on t (c2(50));
- alter table t add index i3 (c2(50));

Not working :
- create table t (c1 int not null, c2 varchar(500), primary key (c2(50)))engine=ndb; 
- create table t (c1 int not null, c2 varchar(500), unique index i1 (c2(50))) engine=ndb; 
- create unique index i2 on t (c2(50));
- alter table t add unique index i3 (c2(50));
[15 Sep 2015 9:01] Bruno ASTIER
Discussed in forum http://forums.mysql.com/read.php?25,634944,634944#msg-634944
[15 Sep 2015 9:41] MySQL Verification Team
Hello Bruno ASTIER,

Thank you for the report and test case.

Thanks,
Umesh
[8 Feb 2016 13:17] Jon Stephens
Documented fix as follows in the NDB 7.4.11 changelog:

NDB failed to ignore index prefixes on primary and unique keys, causing CREATE TABLE and ALTER TABLE statements using these to be rejected.

Closed.