v.19.8New Features
Added Functions Ipv4cidrtoipv4range and Ipv6cidrtoipv6range to Calculate the Lower and Higher Bounds for an IP in the Subnet Using a CIDR
Added functionsIPv4CIDRtoIPv4RangeandIPv6CIDRtoIPv6Rangeto calculate the lower and higher bounds for an IP in the subnet using a CIDR. #5095 (Guillaume Tassery)
Why it matters
These functions provide an easy way to determine the IP range covered by a CIDR block, enabling users to perform subnet calculations directly in ClickHouse. This solves the problem of manually computing IP subnet boundaries and simplifies network-related queries and analysis.How to use it
Use the functions<code>IPv4CIDRtoIPv4Range(cidr)</code> for IPv4 CIDR blocks and <code>IPv6CIDRtoIPv6Range(cidr)</code> for IPv6 CIDR blocks. Each function returns a tuple containing the lower and upper bounds of the IP range covered by the provided CIDR. For example:SELECT IPv4CIDRtoIPv4Range('192.168.1.0/24');
SELECT IPv6CIDRtoIPv6Range('2001:db8::/32');