hostmask() 是一个系统函数,用于计算提供 IP 地址网络的 主机掩码。
hostmask() 添加于 PostgreSQL 7.4。
示例
hostmask() 的使用示例
postgres=# SELECT hostmask('192.168.1.2/32');
hostmask
----------
0.0.0.0
(1 row)
postgres=# SELECT hostmask('192.168.1.2/31');
hostmask
----------
0.0.0.1
(1 row)
postgres=# SELECT hostmask('192.168.1.2/16');
hostmask
-------------
0.0.255.255
(1 row)
参考资料
- PostgreSQL 文档: IP 地址函数
