Re: Changing the continuation-line prompt in psql?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Changing the continuation-line prompt in psql?
Date: 2011-04-29 15:22:39
Message-ID: 5703.1304090559@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Magnus Hagander <magnus(at)hagander(dot)net> writes:
> On Fri, Apr 29, 2011 at 17:09, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> ... Two different possible changes were suggested:
>>
>> * Drop the database name from PROMPT2, so you see
>>
>> postgres=>
>> ->

> Definite -1 on that option - your query no longer lines up, and if you
> then for example open it in an editor, indentation changes.

Yeah, there is that. I just went over to see what the competition does
here, and it looks like this:

mysql> select 2
-> +2
-> + 'foo
'> bar
'> baz'
-> "quoted
"> identifier"
-> /*
/*> comment */
-> ;

AFAICT the initial prompt is always "mysql> ", so they don't have to
think hard about how many spaces to insert to make it line up. But
we could certainly invent a prompt escape that means "as many spaces
as there are characters in the current DB name". (Or maybe we should
try to generalize that idea, so you could get similar behavior for
custom prompts involving usernames etc?)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David E. Wheeler 2011-04-29 16:04:35 Re: Changing the continuation-line prompt in psql?
Previous Message Joshua Berkus 2011-04-29 15:19:15 Re: branching for 9.2devel