Search Postgresql Archives

Need help with Inet type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

   I would like to know if there is a way to do what I need with Postgress.

   I have a table with logs and a table with a list of subnets.

   Right now I do the following query in my table:

   Select * From logs Where src_ip << '10.0.0.0/24' OR src_ip << '10.1.0.0/24' OR src_ip << '172.168.1.0/28';

   I would like to simplify that query and use a table instead as the source of the subnet I want to check.

   I have a table that contain a list of subnet and zone name:

   ZONE_a   10.0.0.0/24
   ZONE_a    10.1.0.0/24
   ZONE_a    172.16.1.0/28
   ZONE_b    10.2.0.0/24
   ZONE_b    10.3.0.0/24

  I can do something like:

   Select * From logs Where src_ip IN (Select ip from ip_table where zone = 'ZONE_a');

   Of course that does not work since it does not work with Inet type and I cannot use << because I have more than 1 row return from the second select.

   Is there a way to achive that?

Thanks.


_______________________
Eric Lamer
IT Security Specialist
INTACT Financial Corporation
(450) 778-9580 ext. 3744

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux