gethostbyaddr() or equivalent?

From: Jeff Boes <jboes(at)nexcerpt(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: gethostbyaddr() or equivalent?
Date: 2002-09-10 15:24:47
Message-ID: all2qe$2led$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Daryl Beattie 2002-09-10 15:45:52 Re: [JDBC] Selecting Varchar range (through JDBC).
Previous Message Stephan Szabo 2002-09-10 15:21:12 Re: statement triggers