Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PostgreSQL,CIDR-从CIDR数组中搜索网络中包含的所有ip地址_Sql_Arrays_Postgresql_Search_Cidr - Fatal编程技术网

PostgreSQL,CIDR-从CIDR数组中搜索网络中包含的所有ip地址

PostgreSQL,CIDR-从CIDR数组中搜索网络中包含的所有ip地址,sql,arrays,postgresql,search,cidr,Sql,Arrays,Postgresql,Search,Cidr,我有一个包含两个cidr数组的表。一个包含主机ip地址,另一个包含网络地址 我需要编写一个函数来执行如下查询: SELECT * from sometable WHERE ip_addr IN( 'all items from first array') OR ip_addr << 'all item from second array' SELECT*fromsometable 其中ip_addr IN(‘第一个数组中的所有项’)或 ip_addr如果我理解正确,您正在寻找 选

我有一个包含两个cidr数组的表。一个包含主机ip地址,另一个包含网络地址

我需要编写一个函数来执行如下查询:

SELECT * from sometable 
WHERE ip_addr IN( 'all items from first array') OR
ip_addr << 'all item from second array'
SELECT*fromsometable
其中ip_addr IN(‘第一个数组中的所有项’)或

ip_addr如果我理解正确,您正在寻找

选择*
从某处
其中(ip_addr=ANY(‘第一个数组中的所有项’)
或者ip地址谢谢:)正是我想要的。
SELECT * 
  FROM sometable 
 WHERE (   ip_addr  = ANY ('all items from first array') 
        OR ip_addr << ANY ('all item from second array')
       )