make inet and cidr compatible
@@ -142,10 +142,18 @@ impl Display for PgTypeInfo {
impl TypeInfo for PgTypeInfo {
fn compatible(&self, other: &Self) -> bool {
+ match (self.id, other.id) {
+ (TypeId::CIDR, TypeId::INET)
+ | (TypeId::INET, TypeId::CIDR)
+ | (TypeId::ARRAY_CIDR, TypeId::ARRAY_INET)
+ | (TypeId::ARRAY_INET, TypeId::ARRAY_CIDR) => true,
+ _ => {
// TODO: 99% of postgres types are direct equality for [compatible]; when we add something that isn't (e.g, JSON/JSONB), fix this here
self.id.0 == other.id.0
}
}
+ }
+}
impl<'de, T> Decode<'de, Postgres> for Option<T>
where
