↑↓ select ↵ open ⌫ change scope Open full search

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

Functions / Network Address Functions And Operators

Sets the netmask length for an inet value.

Reading PG 18current·documented in 26 of 27 versions, 7.2 to 20

Signatures & examples

set_masklen ( inet, integer ) → inet
Sets the netmask length for an inet value. The address part does not change.
set_masklen(inet '192.168.1.5/24', 16) → 192.168.1.5/16
set_masklen ( cidr, integer ) → cidr
Sets the netmask length for a cidr value. Address bits to the right of the new netmask are set to zero.
set_masklen(cidr '192.168.1.0/24', 16) → 192.168.0.0/16
Version history 5
  1. 12 → 13 changed
  2. 8.1 → 8.2 changed
  3. 8.0 → 8.1 changed
  4. 7.3 → 7.4 changed
  5. 7.1 → 7.2 added

Definition snapshot: b7bd9cda · English manual source