PostgreSQL | Data Types | Network Address Types (cidr, inet, macaddr)
This page introduces network address types. The available types are as follows.
| Type | Size | Description |
|---|---|---|
| cidr | 12 or 24 bytes | IPv4 and IPv6 networks |
| inet | 12 or 24 bytes | IPv4 or IPv6 hosts and networks |
| macaddr | 6 bytes | MAC address |
Both inet and cidr are types for representing Internet addresses. For example, write them in the form address / number of bits in netmask, such as 192.168.128.0/24. Both IPv4 and IPv6 can be written.
The macaddr type stores hardware-specific MAC addresses. Examples are as follows.
'08002b:010203'
'08002b-010203'
'0800.2b01.0203'
'08-00-2b-01-02-03'
'08:00:2b:01:02:03'