Skip to content

Commit

Permalink
fix the empty select bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zorancv committed Nov 4, 2024
1 parent e03a549 commit b892793
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion store/postgres/src/relational_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2091,7 +2091,14 @@ impl<'a> QueryFragment<Pg> for FindRangeQuery<'a> {
}
}
}
out.push_sql("\norder by block_number, entity, id");

if first {
// In case we have only immutable entities, the upper range will not create any
// select statement. So here we have to generate an empty SQL statement.
out.push_sql("select 1");
} else {
out.push_sql("\norder by block_number, entity, id");
}

Ok(())
}
Expand Down

0 comments on commit b892793

Please sign in to comment.