Re: Changing the continuation-line prompt in psql?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christopher Browne <cbbrowne(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Changing the continuation-line prompt in psql?
Date: 2011-04-29 17:27:57
Message-ID: 7614.1304098077@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Christopher Browne <cbbrowne(at)gmail(dot)com> writes:
>> Excerpts from David E. Wheeler's message of vie abr 29 13:04:35 -0300 2011:
>>> +1 I like this idea, so the prompt might by default be
>>>
>>> postgres=>
>>> +>

> That's certainly a reasonable sort of start.

> It seems like pretty serious bikeshedding to try to come up with an
> operator to express "do as many of character X as the length of
> variable $FOO".

The idea that I was considering was to define the prompt sequence "% X"
to mean "as many spaces as %X would produce characters", for any X.

> The "bike shedding" that I'd rather have would involve enclosing
> prompts with /* comments */ so that cut'n'paste could be expected to
> generate output that could run, without further editing, in another
> psql session. Mind you, whenever I have configured such, I have been
> unhappy at how wide that makes the prompt and at the loss of screen
> space.

Well, you can do that today, whenever you need it, by modifying the
values of PROMPT1 and PROMPT2. The loss-of-screen-space issue makes me
think it'd not be very reasonable to make it the default.

> I'm not totally appalled at the thought of subsequent lines not being
> perfectly aligned with the first one - frequently, the first line of a
> multiline query is differently indented or has different proper policy
> (e.g. - CREATE OR REPLACE FUNCTION *can* safely differ from the body
> of the function).

It wasn't bothering me either initially, but the argument about the
command looking different when you suck it into an editor with \e
has some credibility.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2011-04-29 18:06:12 Re: Changing the continuation-line prompt in psql?
Previous Message Stephen Frost 2011-04-29 17:23:31 Re: Changing the continuation-line prompt in psql?