Skip to content

Commit ca47ec7

Browse files
Zoran Cvetkovincrypto32
authored andcommitted
fix the empty select bug
1 parent a0d12dd commit ca47ec7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

store/postgres/src/relational_queries.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2091,7 +2091,14 @@ impl<'a> QueryFragment<Pg> for FindRangeQuery<'a> {
20912091
}
20922092
}
20932093
}
2094-
out.push_sql("\norder by block_number, entity, id");
2094+
2095+
if first {
2096+
// In case we have only immutable entities, the upper range will not create any
2097+
// select statement. So here we have to generate an empty SQL statement.
2098+
out.push_sql("select 1");
2099+
} else {
2100+
out.push_sql("\norder by block_number, entity, id");
2101+
}
20952102

20962103
Ok(())
20972104
}

0 commit comments

Comments
 (0)