gethostbyaddr() or equivalent? - Mailing list pgsql-general

From Jeff Boes
Subject gethostbyaddr() or equivalent?
Date
Msg-id all2qe$2led$1@news.hub.org
Whole thread Raw
Responses Re: gethostbyaddr() or equivalent?  (Alvaro Herrera <alvherre@atentus.com>)
List pgsql-general
I have a table which contains IP addresses (written as a log by
applications which may or may not be local to the box hosting the
database):

log_time  | timestamp
ip_addr   | text

I would like to display the ip_addr column as a symbolic hostname (all
the IP addresses are local and well-known).  My initial attempt was to
write a simple PLPerl function:

CREATE FUNCTION fn_ip2name(text) returns text as '
use Socket;
return scalar gethostbyaddr(inet_aton($_[0]),AF_INET)
' language 'plperl';

However, this fails:

ERROR:  creation of function failed:
require trapped by operation mask at (eval 2) line 2.

Any suggestions?

--
Jeff Boes                                      vox 269.226.9550 ext 24
Database Engineer                                     fax 269.349.9076
Nexcerpt, Inc.                                 http://www.nexcerpt.com
           ...Nexcerpt... Extend your Expertise

pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: statement triggers
Next
From: Daryl Beattie
Date:
Subject: Re: [JDBC] Selecting Varchar range (through JDBC).