You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Npgsql currently PG cidr to .NET ValueTuple<IPAddress, int> by default, and also allows mapping inet to it. There's also an obsolete NpgsqlInet mutable struct. For 8.0, we'll do the following changes:
We'll un-obsolete NpgsqlInet, make it an immutable struct and clean it up.
IPAddress will remain the default mapping for inet, as that's what most users use it for.
Note that as before, reading an inet with a non-full netmask silently truncates the value. This seems reasonable as the primary usage of inet is to store simple host IPs (i.e. IPAddress). If the netmask component is significant, NpgsqlInet mapping can be used instead.
We'll also introduce a similar immutable NpgsqlCidr struct, and remove the value tuple mapping.
NpgsqlCidr will be the default mapping for cidr, as that type is used to represent networks, where both the IP and netmask components are important.
The ValueTuple mapping will be removed.
Some notes on why it makes sense to have separate NpgsqlInet and NpgsqlCidr types for PG inet and cidr:
inet can represent a single IP Address, and so should be constructible/castable from one; that's not the case for cidr.
inet ToString doesn't output the netmask if it has all bits (32 for IPv4/128 for IPv6). This doesn't really make sense for cidr.
Having a separate CLR type for cidr would allow mapping it by default without requiring explicit specification of NpgsqlDbType/DataTypeName.
The text was updated successfully, but these errors were encountered:
Npgsql currently PG
cidr
to .NETValueTuple<IPAddress, int>
by default, and also allows mappinginet
to it. There's also an obsolete NpgsqlInet mutable struct. For 8.0, we'll do the following changes:inet
, as that's what most users use it for.inet
with a non-full netmask silently truncates the value. This seems reasonable as the primary usage ofinet
is to store simple host IPs (i.e. IPAddress). If the netmask component is significant, NpgsqlInet mapping can be used instead.cidr
, as that type is used to represent networks, where both the IP and netmask components are important.Some notes on why it makes sense to have separate NpgsqlInet and NpgsqlCidr types for PG
inet
andcidr
:inet
can represent a single IP Address, and so should be constructible/castable from one; that's not the case forcidr
.inet
ToString doesn't output the netmask if it has all bits (32 for IPv4/128 for IPv6). This doesn't really make sense forcidr
.cidr
would allow mapping it by default without requiring explicit specification of NpgsqlDbType/DataTypeName.The text was updated successfully, but these errors were encountered: