pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Paul Förster <paul.foerster@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: HOST variable in psql
Date: Mon, 27 Apr 2020 08:20:06 -0400
Message-ID: <3325.1587990006@sss.pgh.pa.us> (raw)
In-Reply-To: <91ADA44B-9EFA-4784-A45F-8323B3F552B3@gmail.com>
References: <91ADA44B-9EFA-4784-A45F-8323B3F552B3@gmail.com>

=?utf-8?Q?Paul_F=C3=B6rster?= <paul.foerster@gmail.com> writes:
> the use of :HOST in psql containing the socket directory for local connections is pretty useless for us, so we set it to the hostname in a global psqlrc file:
> \set HOST `hostname -s`
> This works great when invoking psql on the command line. But if I perform a \c to connect to a different database in the database cluster, then :HOST gets reset to the socket directory. On the one hand, this makes sense, on the other, the global psqlrc file does not seem to be executed again, thus leaving :HOST in an unuable state for us:

AFAICS, psql is behaving as documented.  Why are you trying to override
HOST like that, instead of just using some other variable?

			regards, tom lane





view thread (5+ messages)  latest in thread

Message-ID: <3325.1587990006@sss.pgh.pa.us>
Permalink:  ../3325.1587990006@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3325.1587990006@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, paul.foerster@gmail.com
  Subject: Re: HOST variable in psql
  In-Reply-To: <3325.1587990006@sss.pgh.pa.us>
  References: <91ADA44B-9EFA-4784-A45F-8323B3F552B3@gmail.com> <3325.1587990006@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox