mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-04 08:54:20 +01:00
Merge 'Fix: return NULL for rowid() when cursor's null flag is on' from Jussi Saurio
Fixes TPC-H query 13 from returning an incorrect result. In this specific case, we were returning non-null `IdxRowid` values for the right-hand side table even when there was no match with the left-hand side table, meaning the join produced matches even in cases where there shouldn't have been any. Closes #2794 Closes #2795
This commit is contained in:
@@ -4321,6 +4321,9 @@ impl BTreeCursor {
|
||||
return Ok(IOResult::Done(None));
|
||||
}
|
||||
}
|
||||
if self.get_null_flag() {
|
||||
return Ok(IOResult::Done(None));
|
||||
}
|
||||
if self.has_record.get() {
|
||||
let page = self.stack.top();
|
||||
let page = page.get();
|
||||
|
||||
@@ -302,3 +302,12 @@ do_execsql_test left-join-backwards-iteration {
|
||||
} {12|Alan|
|
||||
11|Travis|accessories
|
||||
10|Daniel|coat}
|
||||
|
||||
# regression test for issue 2794: not nulling out rowid properly when left join does not match
|
||||
do_execsql_test_on_specific_db {:memory:} min-null-regression-test {
|
||||
create table t (x integer primary key, y);
|
||||
create table u (x integer primary key, y);
|
||||
insert into t values (1,1),(2,2);
|
||||
insert into u values (1,1),(3,3);
|
||||
select count(u.x) from t left join u using(y);
|
||||
} {1}
|
||||
Reference in New Issue
Block a user