IP 地址或 inet 类型的 Postgres "is not contained by" 运算符

Postgres "is not contained by" operator for IP addresses or inet types

Postgres 有一个运算符用于确定 IP 地址是否包含在给定范围内,例如:

SELECT * FROM clients WHERE ip_address <<= inet '10.0.0.0/16';

我如何过滤反向集,即不在该子网中的地址集?网络功能的文档似乎没有可以执行此操作的运算符。 https://www.postgresql.org/docs/12/functions-net.html

使用NOT:

SELECT * 
FROM clients 
WHERE NOT (ip_address <<= inet '10.0.0.0/16');

括号不是必需的,inet 运算符的优先级高于布尔运算符。