Skip to content

Commit

Permalink
Merge pull request #4709 from driftluo/fix-pg-sqlite-inconsistent-types
Browse files Browse the repository at this point in the history
fix: fix pg sqlite inconsistent types
  • Loading branch information
driftluo authored Nov 13, 2024
2 parents 8cb49e4 + be617e7 commit deff22f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 2 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ ignore = [
# Advisory: https://rustsec.org/advisories/RUSTSEC-2024-0370
# proc-macro-error's maintainer seems to be unreachable, with no commits for 2 years, no releases pushed for 4 years, and no activity on the GitLab repo or response to email.
"RUSTSEC-2024-0370",
# instant's maintainer no longer maintained, use web-time instead
"RUSTSEC-2024-0384",
#"RUSTSEC-0000-0000",
#{ id = "RUSTSEC-0000-0000", reason = "you can specify a reason the advisory is ignored" },
#"[email protected]", # you can also ignore yanked crate versions if you wish
Expand Down
22 changes: 19 additions & 3 deletions util/rich-indexer/src/indexer/remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,19 @@ async fn script_exists_in_output(
.await
.map_err(|err| Error::DB(err.to_string()))?;

if row_lock.get::<i64, _>(0) == 1 {
return Ok(true);
// pg type is BOOLEAN
match row_lock.try_get::<bool, _>(0) {
Ok(r) => {
if r {
return Ok(true);
}
}
Err(_) => {
// sqlite type is BIGINT
if row_lock.get::<i64, _>(0) == 1 {
return Ok(true);
}
}
}

let row_type = sqlx::query(
Expand All @@ -237,7 +248,12 @@ async fn script_exists_in_output(
.await
.map_err(|err| Error::DB(err.to_string()))?;

Ok(row_type.get::<i64, _>(0) == 1)
// pg type is BOOLEAN
match row_lock.try_get::<bool, _>(0) {
Ok(r) => Ok(r),
// sqlite type is BIGINT
Err(_) => Ok(row_type.get::<i64, _>(0) == 1),
}
}

fn sqlx_param_placeholders(range: std::ops::Range<usize>) -> Result<Vec<String>, Error> {
Expand Down

0 comments on commit deff22f

Please sign in to comment.