8.9. Network Address Types
8.9. Network Address Types
8.9.网路地址类型
PostgreSQL offers data types to store IPv4, IPv6, and MAC addresses, as shown in Table 8.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 9.12).
如表8.21所示,PostgreSQL提供存储IPv4,IPv6和MAC地址的数据类型。最好使用下面提到的类型存储网络地址,而不是使用纯文本格式,因为这些数据类型可以在输入时检查值的有效性,且提供了丰富的操作符和函数(参见9.12节)。
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.
在对inet或cidr数据类型排序时,IPv4总是排在IPv6地址前面,包括封装或映射到IPv6的地址,例如::10.2.3.4或::ffff:10.4.3.2。