Thread: Need help with Inet type
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
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
## Eric Lamer (eric.lamer@intact.net): > 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. How about: SELECT DISTINCT logs.* FROM logs JOIN ip_table ON logs.srcip << ip_table.ip WHERE zone = 'ZONE_a'; Regards, Christoph -- Spare Space
Hi All, I am trying to install postgresql-jdbc but facing java error. sun java is already installed but postgresql-jdbc installing openjdj. please let me know how to resolve this and if you require any other details. ----- AROHI -- View this message in context: http://postgresql.1045698.n5.nabble.com/Need-help-with-Inet-type-tp5770342p5770565.html Sent from the PostgreSQL - general mailing list archive at Nabble.com.
On Wed, 2013-09-11 at 21:49 -0700, arohi wrote: > Hi All, > > I am trying to install postgresql-jdbc but facing java error. sun java is > already installed but postgresql-jdbc installing openjdj. please let me know > how to resolve this and if you require any other details. > > > > ----- > AROHI > -- > View this message in context: http://postgresql.1045698.n5.nabble.com/Need-help-with-Inet-type-tp5770342p5770565.html > Sent from the PostgreSQL - general mailing list archive at Nabble.com. > > Hello Arohi, If you downloaded the JDBC driver from www.postgrseql.org it is just a jar file. You can choose the type, etc. It doesn't install anything else. Any other application using Java can access it assuming paths and permissions are correct. Cheers, Robert