mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-22 16:35:30 +01:00
fix: index seek wrong
This commit is contained in:
@@ -464,9 +464,15 @@ impl BTreeCursor {
|
||||
};
|
||||
let record = crate::storage::sqlite3_ondisk::read_record(payload)?;
|
||||
let found = match op {
|
||||
SeekOp::GT => record > *index_key,
|
||||
SeekOp::GE => record >= *index_key,
|
||||
SeekOp::EQ => record == *index_key,
|
||||
SeekOp::GT => {
|
||||
&record.values[..record.values.len() - 1] > &index_key.values
|
||||
}
|
||||
SeekOp::GE => {
|
||||
&record.values[..record.values.len() - 1] >= &index_key.values
|
||||
}
|
||||
SeekOp::EQ => {
|
||||
&record.values[..record.values.len() - 1] == &index_key.values
|
||||
}
|
||||
};
|
||||
self.stack.advance();
|
||||
if found {
|
||||
|
||||
@@ -318,6 +318,10 @@ do_execsql_test where-age-index-seek-regression-test-2 {
|
||||
select count(1) from users where age > 0;
|
||||
} {10000}
|
||||
|
||||
do_execsql_test where-age-index-seek-regression-test-3 {
|
||||
select age from users where age > 90 limit 1;
|
||||
} {91}
|
||||
|
||||
do_execsql_test where-simple-between {
|
||||
SELECT * FROM products WHERE price BETWEEN 70 AND 100;
|
||||
} {1|hat|79.0
|
||||
|
||||
Reference in New Issue
Block a user