New function: inet_client_addr()...

From: Sean Chittenden <sean(at)chittenden(dot)org>
To: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: New function: inet_client_addr()...
Date: 2004-05-14 22:35:27
Message-ID: FF7B75B8-A5F6-11D8-8163-000A95C705DC@chittenden.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

In stock PostgreSQL, you can get the database name, the username, but
not the address that the client is connecting from (a very, very useful
piece of data).

Function: inet_client_addr()
Args: none
Return type: INET (null on AF_UNIX or some catastrophic failure)
IPv6 safe: yes

The attached patch includes documentation and the relevant code. If
there aren't any problems, I think this patch is ready to be committed.

If someone wants a way to return the path of AF_UNIX connections, I
firmly believe that it should live in a similar, but different
function, otherwise PL code (or whatever) will have to tease out
whether it's a local or remote connection. Not that I think demand is
there for it, but if need be, there should be two more functions
written: unix_client_addr() and just client_addr(). unix_client_addr()
returns TEXT and the path to the socket and client_addr() returns a
TEXT wrapped version of whatever is in MyProcPort->remote_host. -sc

Attachment Content-Type Size
patch.txt text/plain 3.6 KB

Browse pgsql-patches by date

  From Date Subject
Next Message Larry Rosenman 2004-05-15 00:07:04 Updated FAQ_SCO patch
Previous Message Bruno Wolff III 2004-05-14 22:16:03 Re: pg_ctl patch to integrate apache's rotatelogs