Re: Server name in psql prompt - Mailing list pgsql-general

From Mark Morgan Lloyd
Subject Re: Server name in psql prompt
Date
Msg-id hi7o8p$m3c$1@pye-srv-01.telemetry.co.uk
Whole thread Raw
In response to Server name in psql prompt  (Mark Morgan Lloyd <markMLl.pgsql-general@telemetry.co.uk>)
Responses Re: Server name in psql prompt  (Adrian Klaver <adrian.klaver@gmail.com>)
List pgsql-general
hubert depesz lubaczewski wrote:
> On Fri, Jan 08, 2010 at 11:20:36AM +0000, Mark Morgan Lloyd wrote:
>> Is there any way of getting psql to display the name of the
>> currently-connected server in its prompt, and perhaps a custom string
>> identifying e.g. a disc set, without having to create a psqlrc file on
>> every client system that's got a precompiled psql installed?
>
> what exactly is the problem with distributing your own .psqlrc?
>
> for me it's one of the first things that I do - I setup environment.

Thanks everybody for the comments. The problem is that in an environment
where the end-users generally have enough nous (or are sufficiently
assertive) to run their own systems (e.g. an engineering department)
there is still a requirement to protect shared resources like a
database. It's not really feasible for the overall sysadmin to work his
way around all possible machines, work out which distro each is running,
and install a suitable psqlrc in the place expected by that distro's
psql. It's even less feasible to install a shim that forces default
command-line parameters.

When I referred to a disc set I wasn't thinking about something in the
context of PostgreSQL, I was thinking about a group of discs in
removable (Compaq) caddies that might be transferred to one of a number
of chassis. At present I've got one chassis here into which I'm putting
one of two disc sets, both of which are the 8.4 upgrade target: I'd like
to be able to confirm from the client which set is in the chassis.

After playing some more I think there are actually three issues:

i)   Getting psql to take its initial defaults, i.e. if there isn't a
psqlrc file, from the server (e.g. for the prompt).

ii)  Getting the prompt to display the actual hostname of the server,
rather than what was put on the command line which might be an alias or
dotted-quad address.

iii) Getting the prompt to display some other identifier from the server
to identify the disc set.

I don't think anybody else thinks this is an issue so I guess all I can
say is thanks for listening :-)

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

pgsql-general by date:

Previous
From: Fernando Morgenstern
Date:
Subject: Re: Table appears on listing but can't drop it
Next
From: Konrad Garus
Date:
Subject: Re: Rows missing from table despite FK constraint