X-Original-To: pgsql-admin@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id CB88A47684C for ; Thu, 15 May 2003 15:40:29 -0400 (EDT) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with ESMTP id 92747-04 for ; Thu, 15 May 2003 15:39:57 -0400 (EDT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id ADA07476852 for ; Thu, 15 May 2003 14:20:36 -0400 (EDT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 455EFD63E; Thu, 15 May 2003 11:20:34 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id EB88D5C04; Thu, 15 May 2003 11:20:33 -0700 (PDT) Date: Thu, 15 May 2003 11:20:32 -0700 (PDT) From: Stephan Szabo To: ivan Cc: Subject: Re: qestion In-Reply-To: Message-ID: <20030515110907.O63335-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/221 X-Sequence-Number: 8783 On Thu, 15 May 2003, ivan wrote: > On Thu, 15 May 2003, Stephan Szabo wrote: > > > > > On Wed, 14 May 2003, ivan wrote: > > > > > i connect to my postgres only by socket tcp/ip , and i have to know what > > > client is connected to postgres in plpgsql function. I have many useres > > > in pg_hba.conf which can connect to server from all local network. > > > Then i need know from which client is connection. Is same way to check it > > > ? or rewrite postmaster ? > > > > Do you need the ip address or only what user is connected? The latter can > > be got at with CURRENT_USER or USER. > > Yes i know about CURRENTUSER , but i need ip address to intentify > clients. I don't think there's a builtin function that will give that to you, but you may be able to write a C function that'll do that but I'm not sure what'd be involved. > > > ... oh , is possible to change pg_hba.conf in plpgsql function, ie, when i > > > create new user (throught plpgsql func.) i need to add ip address, which > > > will be used by this new user. > > > > Probably not. You'd probably have to write a function in something else > > and call it from the plpgsql function. However, there's still an issue of > > how to handle rollbacks since you can't easily roll back the changes. It > > might be better to have something that's connected and LISTENing and then > > do a NOTIFY when you add users and have the outside thing figure out what > > entries belong in pg_hba.conf. > > > > but can i change pg_hba.conf with result , without restarting ? You might need to HUP the postmaster, but you shouldn't need to shutdown and restart.