Function inet_aton

Source
pub fn inet_aton(str: &str) -> Result<i64>
Expand description

Given the dotted-quad representation of an IPv4 network address as a string, returns an integer that represents the numeric value of the address in network byte order (big endian). The returning value is a BIGINT (8-byte integer) because PG doesn’t support unsigned 32-bit integer.

Short-form IP addresses (such as ‘127.1’ as a representation of ‘127.0.0.1’) are NOT supported.

This function is ported from MySQL. Ref: https://dev.mysql.com/doc/refman/8.3/en/miscellaneous-functions.html#function_inet-aton.

§Example

query I
select inet_aton('10.0.5.9');
----
167773449