fix: deprecation warning in tests/postgres/macros.rs

This commit is contained in:
Austin Bonander 2025-03-31 03:09:47 -07:00
parent 80abc5b166
commit b989b366c2
2 changed files with 3 additions and 2 deletions

View File

@ -413,7 +413,7 @@ macro_rules! impl_type_checking {
$(
if <$bigdecimal_ty as sqlx_core::types::Type<$database>>::type_info() == *info {
if cfg!(feature = "rust_decimal") {
return Err($crate::type_checking::Error::AmbiguousDateTimeType {
return Err($crate::type_checking::Error::AmbiguousNumericType {
fallback: stringify!($bigdecimal_ty),
});
}
@ -425,7 +425,7 @@ macro_rules! impl_type_checking {
$(
if <$bigdecimal_ty as sqlx_core::types::Type<$database>>::compatible(info) {
if cfg!(feature = "rust_decimal") {
return Err($crate::type_checking::Error::AmbiguousDateTimeType {
return Err($crate::type_checking::Error::AmbiguousNumericType {
fallback: stringify!($bigdecimal_ty),
});
}

View File

@ -295,6 +295,7 @@ async fn query_by_bigdecimal() -> anyhow::Result<()> {
let decimal = "1234".parse::<BigDecimal>()?;
let ref tuple = ("51245.121232".parse::<BigDecimal>()?,);
#[cfg_attr(feature = "rust_decimal", allow(deprecated))] // TODO: upgrade to `expect`
let result = sqlx::query!(
"SELECT * from (VALUES(1234.0)) decimals(decimal)\
where decimal in ($1, $2, $3, $4, $5, $6, $7)",