Re: HOST variable in psql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Paul Förster <paul(dot)foerster(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: HOST variable in psql
Date: 2020-04-27 12:20:06
Message-ID: 3325.1587990006@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

=?utf-8?Q?Paul_F=C3=B6rster?= <paul(dot)foerster(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matthias Apitz 2020-04-27 12:21:23 PostgreSQL client hangs sometimes on 'EXEC SQL PREPARE sid_sisisinst FROM :select_anw;'
Previous Message Magnus Hagander 2020-04-27 09:37:34 Re: PostgreSQL Server version compatibility check with Window 2016