Network Functions

PostgreSQL includes many functions that are network oriented. Primarily, these are useful for performing calculations and transformations of IP-related data. The following sections discuss the included network functions in PostgreSQL.

ABBREV

Description

The ABBREV function returns an abbreviated text format for a supplied inet or cidr value.

Input
ABBREV(inet | cidr) 
Example
ABBREV('192.168.0.0/24') → "192.168/24" 

BROADCAST

Description

The BROADCAST function returns the broadcast address of the supplied inet or cidr value.

Input
BROADCAST(inet | cidr) 
Example
BROADCAST('192.168.0.1/24') → '192.168.0.255/24' 

HOST

Description

The HOST function extracts the host address for the supplied inet or cidr value.

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.