Network Types

The SQL type inet describes IPv4 network addresses, such as 192.168.1.5/24.

Usage example:

CREATE TABLE inet_example (address inet NOT NULL);

A valid IPv4 Network Address string has a specific syntax, see also IPv4 address.

You can use cast() and convert() functions to convert a valid inet string into an inet value.

select cast('192.168.1.5/24' as inet); 
select convert('192.168.1.5/24', inet); 

You can also use the inet casting prefix:

select inet '192.168.1.5/24'; 

The inet module contains a collection of functions and operators that operate on IPv4 addresses. The most relevant functions are the 'containment' functions that deal with subnet masks. The functionality of this module is greatly inspired by the PostgreSQL inet data type.

It is currently extended to also support IPv6.