postgresql_16:3.5.9.2 cidr
PostgreSQL 16 > The SQL Language > Data Types > Network Address Types > cidr
The cidr type holds an IPv4 or IPv6 network specification. Input and output formats follow Classless Internet Domain Routing conventions. The format for specifying networks is *address/y* where *address* is the network's lowest address represented as an IPv4 or IPv6 address, and *y* is the number of bits in the netmask. If *y* is omitted, it is calculated using assumptions from the older classful network numbering system, except it will be at least large enough to include all of the octets written in the input. It is an error to specify a network address that has bits set to the right of the specified netmask.
(see datatype-net-cidr-table) shows some examples.
| cidr Input | cidr Output | `abbrev(cidr)` | | --- | --- | --- | | 192.168.100.128/25 | 192.168.100.128/25 | 192.168.100.128/25 | | 192.168/24 | 192.168.0.0/24 | 192.168.0/24 | | 192.168/25 | 192.168.0.0/25 | 192.168.0.0/25 | | 192.168.1 | 192.168.1.0/24 | 192.168.1/24 | | 192.168 | 192.168.0.0/24 | 192.168.0/24 | | 128.1 | 128.1.0.0/16 | 128.1/16 | | 128 | 128.0.0.0/16 | 128.0/16 | | 128.1.2 | 128.1.2.0/24 | 128.1.2/24 | | 10.1.2 | 10.1.2.0/24 | 10.1.2/24 | | 10.1 | 10.1.0.0/16 | 10.1/16 | | 10 | 10.0.0.0/8 | 10/8 | | 10.1.2.3/32 | 10.1.2.3/32 | 10.1.2.3/32 | | 2001:4f8:3:ba::/64 | 2001:4f8:3:ba::/64 | 2001:4f8:3:ba/64 | | 2001:4f8:3:ba:2e0:81ff:fe22:d1f1/128 | 2001:4f8:3:ba:2e0:81ff:fe22:d1f1/128 | 2001:4f8:3:ba:2e0:81ff:fe22:d1f1/128 | | ::ffff:1.2.3.0/120 | ::ffff:1.2.3.0/120 | ::ffff:1.2.3/120 | | ::ffff:1.2.3.0/128 | ::ffff:1.2.3.0/128 | ::ffff:1.2.3.0/128 |