give this a try if you don't mind using plperlu.  This was tested with 
Postgresql 8.0.3


create or replace function gethostbyaddr(inet) returns text
as
$$
use strict;
use Socket;
my $inet = $_[0];
my $iaddr=inet_aton($inet);
my $name = gethostbyaddr($iaddr,AF_INET);
return $name;
$$
language plperlu;

select gethostbyaddr('199.181.132.250'::inet);




---------- Original Message -----------
From: "Marcel Gsteiger" <[EMAIL PROTECTED]>
To: <pgsql-general@postgresql.org>
Sent: Wed, 19 Oct 2005 14:36:46 +0200
Subject: [GENERAL] function that resolves IP addresses

> Hi all
> 
> Does anybody know how I could create a database function that accepts
> an INET parameter and reverse-lookups the hostname via DNS PTR lookup?
> Something like the dnsname command line utility in the djbdns package. I
> need this function for analyzing firewall logs stored in the database
> with ulogd.
> 
> Any idea would much be appreciated.
> 
> Regards
> --Marcel
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
------- End of Original Message -------


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to