Skip to content

Commit

Permalink
store: Fix check for deterministic error
Browse files Browse the repository at this point in the history
The check for a deterministic error in deployment::state was wrong in that
it claimed that it contained a `sql::<Integer>` but a query using `min`
will return null when there are no rows. The query needs to say
`sql::<Nullable<Integer>>`
  • Loading branch information
lutter committed Apr 10, 2024
1 parent 79e179b commit 4dcf3ab
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions store/postgres/src/deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,8 @@ pub fn state(conn: &mut PgConnection, id: DeploymentHash) -> Result<DeploymentSt
e::table
.filter(e::subgraph_id.eq(id.as_str()))
.filter(e::deterministic)
.select(sql::<Integer>("min(lower(block_range))"))
.first::<i32>(conn)
.optional()?
.select(sql::<Nullable<Integer>>("min(lower(block_range))"))
.first::<Option<i32>>(conn)?
} else {
None
};
Expand Down

0 comments on commit 4dcf3ab

Please sign in to comment.