Network Data Types

PostgreSQL is unique among many SQL systems in that it includes built-in data types for network addresses. CIDR, INET, and MACADDR all represent specific aspects of network addresses. These data types can be particularly useful when using PostgreSQL as a back-end database to a web application.

Storing network values in these data types is preferential due to the included functions in PostgreSQL that act on network-specific data types.

CIDR

Description

Holds dotted-quad data for an IP address and the number of bits in the netmask. This data type is named for the Classless Internet Domain Routing (CIDR) convention.

Inputs
x.x.x.x/y 

x.x.x. x—Valid IP address.

y—Bits in the netmask.

Storage Size

12 bytes

Example Data

Get PostgreSQL Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.