From b5ebc0f259de7d3ed8a13adaf161d499f6596b6c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Aug 2004 00:59:16 +0200 Subject: [PATCH] Fix ordered index scan with partially specified key --- mysql-test/r/ndb_index_ordered.result | 6 ++++++ mysql-test/t/ndb_index_ordered.test | 3 +++ ndb/src/ndbapi/NdbScanOperation.cpp | 11 ++++------- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/ndb_index_ordered.result b/mysql-test/r/ndb_index_ordered.result index 75de1ac4a7f..1441e53e935 100644 --- a/mysql-test/r/ndb_index_ordered.result +++ b/mysql-test/r/ndb_index_ordered.result @@ -205,4 +205,10 @@ a b c select * from t1 where b<=5 and c=0 or b<=5 and c=2; a b c 19 4 0 +select count(*) from t1 where b = 0; +count(*) +0 +select count(*) from t1 where b = 1; +count(*) +1 drop table t1; diff --git a/mysql-test/t/ndb_index_ordered.test b/mysql-test/t/ndb_index_ordered.test index 3def52e865c..cffe9236fb5 100644 --- a/mysql-test/t/ndb_index_ordered.test +++ b/mysql-test/t/ndb_index_ordered.test @@ -113,6 +113,9 @@ select * from t1 where b<=5 and c=0; select * from t1 where b=4 and c<=5 order by a; select * from t1 where b<=4 and c<=5 order by a; select * from t1 where b<=5 and c=0 or b<=5 and c=2; + +select count(*) from t1 where b = 0; +select count(*) from t1 where b = 1; drop table t1; # diff --git a/ndb/src/ndbapi/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp index 52cb4cecb02..0aa40f968bb 100644 --- a/ndb/src/ndbapi/NdbScanOperation.cpp +++ b/ndb/src/ndbapi/NdbScanOperation.cpp @@ -1188,13 +1188,11 @@ NdbIndexScanOperation::fix_get_values(){ for(Uint32 i = 0; im_columns[i]; - NdbColumnImpl * col = tab->getColumn(key->m_keyInfoPos); - curr->setup(col, 0); - } - break; + case FAKE_PTR: + curr->setup(curr->m_column, 0); case API_PTR: + curr = curr->next(); + break; case SETBOUND_EQ: break; #ifdef VM_TRACE @@ -1202,7 +1200,6 @@ NdbIndexScanOperation::fix_get_values(){ abort(); #endif } - curr = curr->next(); } }