Skip to content

Commit 317ac04

Browse files
incrypto32Zoran Cvetkov
authored andcommitted
store: fix block range query bug when getting entity triggers
1 parent 070c25d commit 317ac04

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

store/postgres/src/block_range.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ impl<'a> BlockRangeColumn<'a> {
264264
table_prefix: _,
265265
block_range: BlockRange(start, finish),
266266
} => {
267-
out.push_sql("block_range && int4range(");
267+
out.push_sql("lower(block_range) >= ");
268268
match start {
269269
Bound::Included(block) => out.push_bind_param::<Integer, _>(block)?,
270270
Bound::Excluded(block) => {
@@ -273,7 +273,7 @@ impl<'a> BlockRangeColumn<'a> {
273273
}
274274
Bound::Unbounded => todo!(),
275275
};
276-
out.push_sql(",");
276+
out.push_sql(" AND lower(block_range) <= ");
277277
match finish {
278278
Bound::Included(block) => {
279279
out.push_bind_param::<Integer, _>(block)?;
@@ -282,7 +282,6 @@ impl<'a> BlockRangeColumn<'a> {
282282
Bound::Excluded(block) => out.push_bind_param::<Integer, _>(block)?,
283283
Bound::Unbounded => todo!(),
284284
};
285-
out.push_sql(")");
286285
Ok(())
287286
}
288287
BlockRangeColumn::ImmutableRange {

0 commit comments

Comments
 (0)