Re: Server name in psql prompt

From: Mark Morgan Lloyd <markMLl(dot)pgsql-general(at)telemetry(dot)co(dot)uk>
To: pgsql-general(at)PostgreSQL(dot)org
Subject: Re: Server name in psql prompt
Date: 2010-01-08 16:59:04
Message-ID: hi7o8p$m3c$1@pye-srv-01.telemetry.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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]

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Konrad Garus 2010-01-08 17:00:19 Re: Rows missing from table despite FK constraint
Previous Message Fernando Morgenstern 2010-01-08 16:55:26 Re: Table appears on listing but can't drop it