abbrev()

缩写 cidr 或 inet 值的函数

abbrev() 是一个系统函数,用于生成 cidrinet 值的缩写形式。

abbrev() 添加于 PostgreSQL 7.1

用法

abbrev ( inet ) → text
abbrev ( cidr ) → text

abbrev() 发出一个省略了网络掩码的 inet 值,或者是一个省略了地址部分末尾全零字节的 cidr 值。

变更历史

示例

使用 abbrev() 处理 inet 值的基本用法示例

postgres=# SELECT abbrev(inet '192.168.1.2/32');
   abbrev    
-------------
 192.168.1.2
(1 row)

使用 abbrev() 处理 cidr 值的基本用法示例

postgres=# SELECT abbrev(cidr '192.168.0.0/16');
   abbrev   
------------
 192.168/16
(1 row)

分类

网络, 系统函数

另请参阅

host(), hostmask(), masklen()

反馈

请在此处提交关于“abbrev()”的任何评论、建议或更正