pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: Alexis Paul Bertolini <bertolini@computer.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: Obtaining client IP address
Date: Fri, 24 Feb 2006 16:34:27 -0700
Message-ID: <20060224233427.GA12772@winnie.fuhr.org> (raw)
In-Reply-To: <43FF93CF.5070808@computer.org>
References: <43FF93CF.5070808@computer.org>

On Sat, Feb 25, 2006 at 12:16:31AM +0100, Alexis Paul Bertolini wrote:
> The client has no idea what public IP it has. The server ought to 
> know... however I haven't found how I could get this info into my query.

What version of PostgreSQL are you running?  In 8.0 and later you
can use inet_client_addr().

http://www.postgresql.org/docs/8.1/interactive/functions-info.html

I forget if earlier versions have a way to get the client's IP
address without resorting to hacks (e.g., writing a function in a
privileged language like plperlu and calling netstat or lsof).

-- 
Michael Fuhr



view thread (3+ messages)  latest in thread

Message-ID: <20060224233427.GA12772@winnie.fuhr.org>
Permalink:  ../20060224233427.GA12772@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20060224233427.GA12772@winnie.fuhr.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mike@fuhr.org, bertolini@computer.org
  Subject: Re: Obtaining client IP address
  In-Reply-To: <20060224233427.GA12772@winnie.fuhr.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox