| The PostgreSQL 9.0 Reference Manual - Volume 1A - SQL Language Reference
by The PostgreSQL Global Development Group Paperback (6"x9"), 454 pages ISBN 9781906966041 RRP £14.95 ($19.95) Sales of this book support the PostgreSQL project! Get a printed copy>>> |
6.9 Network Address Types
PostgreSQL offers data types to store IPv4, IPv6, and MAC addresses, as shown in Table 6-21. It is better to use these types instead of plain text types to store network addresses, because these types offer input error checking and specialized operators and functions (see section 7.12 Network Address Functions and Operators).
Table 6-21: Network Address Types
| Name | Storage Size | Description
|
cidr | 7 or 19 bytes | IPv4 and IPv6 networks
|
inet | 7 or 19 bytes | IPv4 and IPv6 hosts and networks
|
macaddr | 6 bytes | MAC addresses |
When sorting inet or cidr data types,
IPv4 addresses will always sort before IPv6 addresses, including
IPv4 addresses encapsulated or mapped to IPv6 addresses, such as
::10.2.3.4 or ::ffff:10.4.3.2.
| ISBN 9781906966041 | The PostgreSQL 9.0 Reference Manual - Volume 1A - SQL Language Reference | See the print edition |