Skip to main content

Scalar Functions — IP Address

IP functions parse and inspect IPv4 and IPv6 addresses. A key thing to be aware of is that KQL's parse_ipv4() returns an integer representation of the address, while PostgreSQL's equivalent returns an inet type — the two are not directly comparable in mixed queries.

Legend: ✅ Supported · ⚠️ Approximated · ❌ Not Supported · 🔄 Rewritten

FunctionSQLiteMySQLClickHousePostgreSQLDuckDBNotes
parse_ipv4()⚠️MySQL: INET_ATON() returns integer, matching KQL semantics; ClickHouse: IPv4StringToNum() returns integer; Postgres: CAST(... AS inet) returns inet type, not integer; DuckDB: computes the 32-bit integer from the dotted-quad octets, matching KQL's integer semantics
parse_ipv6()⚠️MySQL: INET6_ATON(); Postgres: CAST(... AS inet) returns inet type, not binary integer; DuckDB: not supported — no native inet type
ipv4_is_private()⚠️⚠️Postgres: << inet subnet containment; MySQL: INET_ATON range checks with warning; DuckDB: approximated with prefix string checks (no native inet type)
has_ipv4()⚠️⚠️Substring presence test: ClickHouse position(), DuckDB contains(); approximate — matches the address as text rather than by numeric parsing
has_ipv4_prefix()⚠️⚠️Same substring approximation as has_ipv4()
has_any_ipv4_prefix()⚠️⚠️Prefix-membership test over an array: ClickHouse arrayExists() + startsWith(), DuckDB list_filter() + starts_with(); approximate string-prefix match
note

SQLite has no IP address functions. If your enrichment or federated search queries need to classify or parse IP addresses and your target is SQLite, handle the classification upstream in the pipeline using a script processor before the enrich step.