Thread: Prompts in psql

Prompts in psql

From
Sam Barnett-Cormack
Date:
Is there any way to change the prompt in the psql CLI client? In the
same way as one does with bash, or other shells.

Ideally I want:

username@host:database $

as the prompt. Anyone got any ideas/references?

--

Sam Barnett-Cormack
Software Developer                           |  Student of Physics & Maths
UK Mirror Service (http://www.mirror.ac.uk)  |  Lancaster University

Re: Prompts in psql

From
Bruce Momjian
Date:
Sam Barnett-Cormack wrote:
> Is there any way to change the prompt in the psql CLI client? In the
> same way as one does with bash, or other shells.
>
> Ideally I want:
>
> username@host:database $
>
> as the prompt. Anyone got any ideas/references?

Sure, see the psql manual page.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Prompts in psql

From
Renney Thomas
Date:
Sam Barnett-Cormack wrote:

>Is there any way to change the prompt in the psql CLI client? In the
>same way as one does with bash, or other shells.
>
>Ideally I want:
>
>username@host:database $
>
>as the prompt. Anyone got any ideas/references?
>
>
>

Put
\set PROMPT1 '%n@%m:%~%R%# '
in your .psqlrc file.


Re: Prompts in psql

From
Sam Barnett-Cormack
Date:
On Mon, 1 Sep 2003, Renney Thomas wrote:

> Sam Barnett-Cormack wrote:
>
> >Is there any way to change the prompt in the psql CLI client? In the
> >same way as one does with bash, or other shells.
> >
> >Ideally I want:
> >
> >username@host:database $
> >
> >as the prompt. Anyone got any ideas/references?
> >
> >
> >
>
> Put
> \set PROMPT1 '%n@%m:%~%R%# '
> in your .psqlrc file.

I've just looked in the manpage - does anyone know where psql looks for
a system-wide psqlrc?

--

Sam Barnett-Cormack
Software Developer                           |  Student of Physics & Maths
UK Mirror Service (http://www.mirror.ac.uk)  |  Lancaster University

Re: Prompts in psql

From
Peter Eisentraut
Date:
Sam Barnett-Cormack writes:

> I've just looked in the manpage - does anyone know where psql looks for
> a system-wide psqlrc?

Nowhere.

--
Peter Eisentraut   peter_e@gmx.net


Re: Prompts in psql

From
"A.Bhuvaneswaran"
Date:
> username@host:database $
>
=> \set PROMPT1 '%n@%m:%/ $' -- Refer psql manual for details

regards,
bhuvaneswaran