Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id F20FD632442 for ; Fri, 30 Apr 2010 11:14:14 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 92397-09 for ; Fri, 30 Apr 2010 14:14:06 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from cooker.cnx.rice.edu (cooker.cnx.rice.edu [168.7.5.70]) by mail.postgresql.org (Postfix) with ESMTP id B2EF1633C2C for ; Fri, 30 Apr 2010 11:14:07 -0300 (ADT) Received: from reedstrm by cooker.cnx.rice.edu with local (Exim 4.63) (envelope-from ) id 1O7qyi-0001VG-Mk for pgsql-admin@postgresql.org; Fri, 30 Apr 2010 09:14:04 -0500 Date: Fri, 30 Apr 2010 09:14:04 -0500 From: "Ross J. Reedstrom" To: pgsql-admin@postgresql.org Subject: Re: Querying the hostname of the server Message-ID: <20100430141404.GB28614@rice.edu> Mail-Followup-To: "Ross J. Reedstrom" , pgsql-admin@postgresql.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.96 tagged_above=-10 required=5 tests=AWL=0.950, BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201004/363 X-Sequence-Number: 34457 On Fri, Apr 30, 2010 at 03:33:13PM +0200, Péter Kovács wrote: > Hi, > > I have a number of PostgreSQL servers which I often access through ssh > tunnel with Pgadmin3. I would like to double check which one I have landed > on (if the tunnel is really configured the way I want). Is there a way to > query the hostname from the catalogs? Hmm, that's a bit tricky, since I assume you're using a local db connection inside the tunnel, so inet_server_addr() probably returns null. If you're talking unix/linux machines, then /etc/hostname _should_ have the current hostname in it, so: create temp table foo (t text); copy foo from '/etc/hostname'; select * from foo; drop table foo; Should work. Ross -- Ross Reedstrom, Ph.D. reedstrm@rice.edu Systems Engineer & Admin, Research Scientist phone: 713-348-6166 The Connexions Project http://cnx.org fax: 713-348-3665 Rice University MS-375, Houston, TX 77005 GPG Key fingerprint = F023 82C8 9B0E 2CC6 0D8E F888 D3AE 810E 88F0 BEDE