Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix pg sqlite inconsistent types #4709

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading