Commit d2a0a879 authored by unknown's avatar unknown

ndb - fix ha_ndb crash on ordered index on nullable varchar


mysql-test/r/ndb_index_ordered.result:
  fix ha_ndb crash on ordered index on nullable varchar
mysql-test/t/ndb_index_ordered.test:
  fix ha_ndb crash on ordered index on nullable varchar
sql/ha_ndbcluster.cc:
  fix ha_ndb crash on ordered index on nullable varchar
parent b5f87344
...@@ -652,3 +652,9 @@ show tables; ...@@ -652,3 +652,9 @@ show tables;
Tables_in_test Tables_in_test
t1 t1
drop table t1; drop table t1;
create table t1 (a int, c varchar(10),
primary key using hash (a), index(c)) engine=ndb;
insert into t1 (a, c) values (1,'aaa'),(3,'bbb');
select count(*) from t1 where c<'bbb';
count(*)
1
...@@ -349,4 +349,10 @@ select a from t1 where b = 2; ...@@ -349,4 +349,10 @@ select a from t1 where b = 2;
show tables; show tables;
drop table t1; drop table t1;
# mysqld 5.0.13 crash, no bug#
create table t1 (a int, c varchar(10),
primary key using hash (a), index(c)) engine=ndb;
insert into t1 (a, c) values (1,'aaa'),(3,'bbb');
select count(*) from t1 where c<'bbb';
# End of 4.1 tests # End of 4.1 tests
...@@ -1214,7 +1214,7 @@ inline ulong ha_ndbcluster::index_flags(uint idx_no, uint part, ...@@ -1214,7 +1214,7 @@ inline ulong ha_ndbcluster::index_flags(uint idx_no, uint part,
static void shrink_varchar(Field* field, const byte* & ptr, char* buf) static void shrink_varchar(Field* field, const byte* & ptr, char* buf)
{ {
if (field->type() == MYSQL_TYPE_VARCHAR) { if (field->type() == MYSQL_TYPE_VARCHAR && ptr != NULL) {
Field_varstring* f= (Field_varstring*)field; Field_varstring* f= (Field_varstring*)field;
if (f->length_bytes == 1) { if (f->length_bytes == 1) {
uint pack_len= field->pack_length(); uint pack_len= field->pack_length();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment