Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jT3ZV-00089a-P1 for pgsql-general@arkaria.postgresql.org; Mon, 27 Apr 2020 13:13:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jT3ZU-0007wr-EE for pgsql-general@arkaria.postgresql.org; Mon, 27 Apr 2020 13:13:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jT3ZU-0007wk-7H for pgsql-general@lists.postgresql.org; Mon, 27 Apr 2020 13:13:16 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jT3ZS-00061O-6k for pgsql-general@postgresql.org; Mon, 27 Apr 2020 13:13:15 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 03RDDBLn009171; Mon, 27 Apr 2020 09:13:11 -0400 From: Tom Lane To: =?utf-8?Q?Paul_F=C3=B6rster?= cc: pgsql-general Subject: Re: HOST variable in psql In-reply-to: <0767EAE6-86F3-45D8-87B5-4A9275E3E924@gmail.com> References: <91ADA44B-9EFA-4784-A45F-8323B3F552B3@gmail.com> <3325.1587990006@sss.pgh.pa.us> <0767EAE6-86F3-45D8-87B5-4A9275E3E924@gmail.com> Comments: In-reply-to =?utf-8?Q?Paul_F=C3=B6rster?= message dated "Mon, 27 Apr 2020 14:44:44 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <9169.1587993191.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 27 Apr 2020 09:13:11 -0400 Message-ID: <9170.1587993191@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =3D?utf-8?Q?Paul_F=3DC3=3DB6rster?=3D writes: >> On 27. Apr, 2020, at 14:20, Tom Lane wrote: >> AFAICS, psql is behaving as documented. Why are you trying to override >> HOST like that, instead of just using some other variable? > I could but > a) HOST is HOST and should not point to a socket directory. A socket dir= ectory is not a HOST. This makes no sense, especially since I see no use f= or using a socket directory in any psql script. There are tons of use case= s for the hostname, though. [ shrug... ] When connecting via a Unix socket, psql does not have a relevant "hostname" to report, so it reports what it's got. You are ascribing a meaning to HOST that it does not have, never has had, and never can have in this case. > c) the docs are IMHO not 100% clear on this. I think the psqlrc should b= e executed on EVERY new connect, hence including \c, and this is how I int= erpret the docs too. But it doesn't... There has been some talk of providing a way to execute stuff on reconnect, if memory serves, but nothing's been done about it. regards, tom lane