Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ All changes that a user can see are in this file. The version is 0.M.patch, wher
### Fixed

- A `LATERAL` relation in a nested loop no longer keeps the rows of every run until the query ends. This stopped the server with no memory in the regression tests `join` and `subselect` (#444).
- A correlated subquery finds its rows through an index of a column for `=` with an expression of the outer columns, not only with an outer column (#445).

## 0.1.51 (2026-10-20)

Expand Down
9 changes: 5 additions & 4 deletions crates/rupg-exec/src/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ impl Tables {
index
}

/// True when a relation of the part reads a relation outside the part.
fn depends(&self, relations: &[usize]) -> bool {
relations.iter().any(|r| self.needs[*r].iter().any(|n| !relations.contains(n)))
/// True when a relation of the part `relations` reads a relation of `left`.
fn depends_on(&self, relations: &[usize], left: &[usize]) -> bool {
relations.iter().any(|r| self.needs[*r].iter().any(|n| left.contains(n)))
}
}

Expand Down Expand Up @@ -644,7 +644,8 @@ impl Scan<'_, '_> {
conds: Vec<&'q Expr>,
context: &[usize],
) -> Result<Vec<Vec<usize>>> {
if !self.tables.depends(input.right_relations) {
// A part that reads only relations outside the join, which `context` holds, runs once for all the tuples of the left side.
if !self.tables.depends_on(input.right_relations, input.left_relations) {
input.right = self.item_tuples(item, conds, context)?;
return join(input, self.tables, self.test);
}
Expand Down
Loading