X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 690179DC9BE for ; Sat, 25 Feb 2006 05:27:10 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40246-05 for ; Sat, 25 Feb 2006 05:27:11 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vsmtp1.tin.it (vsmtp1.tin.it [212.216.176.141]) by postgresql.org (Postfix) with ESMTP id CC45E9DC804 for ; Sat, 25 Feb 2006 05:27:07 -0400 (AST) Received: from [192.168.2.32] (82.58.70.2) by vsmtp1.tin.it (7.2.060.1) (authenticated as apbertolini@virgilio.it) id 43EA4CB100C60070 for pgsql-sql@postgresql.org; Sat, 25 Feb 2006 10:27:46 +0100 Message-ID: <440022DD.9000902@computer.org> Date: Sat, 25 Feb 2006 10:26:53 +0100 From: Alexis Paul Bertolini User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 CC: pgsql-sql@postgresql.org Subject: Re: Obtaining client IP address References: <43FF93CF.5070808@computer.org> <20060224233427.GA12772@winnie.fuhr.org> In-Reply-To: <20060224233427.GA12772@winnie.fuhr.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.668 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, MISSING_HEADERS=0.189] X-Spam-Score: 0.668 X-Spam-Level: X-Archive-Number: 200602/311 X-Sequence-Number: 24321 Michael Fuhr wrote: > 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). > > Mmmm, I didn't spot that one, but it did the trick! Thanks! Alex.