On Fri, Apr 29, 2011 at 12:17 PM, Alvaro Herrera <alvhe...@commandprompt.com> wrote: > Excerpts from David E. Wheeler's message of vie abr 29 13:04:35 -0300 2011: >> On Apr 29, 2011, at 8:22 AM, Tom Lane wrote: >> >> > 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?) >> >> +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". I know people have been hacking on zsh and Bash to do wacky things like that - I somewhat doubt that we really want to go too far down that road. (I'd be about equally excited about integrating an APL into psql. Of course, I'm watching <https://github.com/kevinlawler/kona>, which is an ASCII-ized APL clone, so that mightn't be the thing I'd MOST vigorously argue against ;-).) 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. 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). I think I could readily live with PROMPT2=" +>", all in all. -- When confronted by a difficult problem, solve it by reducing it to the question, "How would the Lone Ranger handle this?" -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers