Re: Adding the host name to the PgSQL shell

From: "Roderick A(dot) Anderson" <raanders(at)cyber-office(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Adding the host name to the PgSQL shell
Date: 2009-06-08 22:11:55
Message-ID: 4A2D8CAB.1090503@cyber-office.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Scott Mead wrote:
>
>
>
> On Mon, Jun 8, 2009 at 12:44 PM, Madison Kelly <linux(at)alteeve(dot)com
> <mailto:linux(at)alteeve(dot)com>> wrote:
>
> Hi all,
>
> I work on a development and production server, and I am always
> double-checking myself to make sure I am doing something on the
> right server.
>
> Is there a way, like in terminal shells, to change the PgSQL
> shell's prompt from 'db=>' to something like 'host(at)db=>'? I'm on
> PgSQL 8.1 (server on Debian) and 8.3 (devel on Ubuntu), in case it
> matters.
>
>
> You certainly can do this, very similar to PS1 on linux with bash:
>
> http://www.postgresql.org/docs/8.1/static/app-psql.html#APP-PSQL-PROMPTING

Thanks Scott.

I'll add that the "other" escape codes, well at least newline (\n) work.

So I have in my .psqlrc

\set PROMPT1 '%/@%M\n%# '

And an expansion on the question. I didn't see or find in the
documentation is if there is a substitution code to get the first schema
in search_path?

\\||/
Rod
--

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Verite 2009-06-08 23:31:08 Re: Sum of multiplied deltas
Previous Message Thomas Kellerer 2009-06-08 21:23:01 Re: How to get the size of non fixed-length field from system catalog ?