Network Types

The SQL type inet describes IPv4 network addresses, such as

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('' as inet); 
select convert('', inet); 

You can also use the inet casting prefix:

select inet ''; 

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.