select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Unsupported versions: 6.4
Historical version. PostgreSQL 6.4 reached end of support in October 2003. See the current manual for supported releases.

IP V4 Functions

Table 10-8. PostgresIP V4 Functions

Function Returns Description Example
broadcast(cidr) text construct broadcast address as text broadcast('192.168.1.5/24') ==> '192.168.1.255'
broadcast(inet) text construct broadcast address as text broadcast('192.168.1.5/24') ==> '192.168.1.255'
host(inet) text extract host address as text host('192.168.1.5/24') ==> '192.168.1.5'
masklen(cidr) int4 calculate netmask length masklen('192.168.1.5/24') ==> 24
masklen(inet) int4 calculate netmask length masklen('192.168.1.5/24') ==> 24
netmask(inet) text construct netmask as text netmask('192.168.1.5/24') ==> '255.255.255.0'

Report a documentation issue

Read the upstream documentation. For corrections, first check the current manual.