there's an interesting thread about a novice who forgot to put a
semicolon at the end of his SQL commands, and what psql might do to be
a little more friendly at the beginning of the learning curve. We see
similar complaints every so often, so it seems like something that would
be worth doing something about. Several ideas were mentioned, but the
one that seemed to get the most approval was to make psql's PROMPT2
(the continuation line prompt) more visibly different from PROMPT1.
I've got to agree that the difference between
is on the subtle side. Two different possible changes were suggested:
* Drop the database name from PROMPT2, so you see
* Change the continuation-line marker from "-" to "+", so you see
We could do either or both of these. If we did both it'd look like
"+" seems like an obviously more mnemonic marker than "-" for additional
lines, in addition to being more visually distinct. Dropping the DB
name would change the length of the prompt, which even the most clueless
noob ought to recognize as a cue about change of state, but maybe that
would be too distracting for anyone past the noob stage.
One possibly pleasant aspect of dropping the DB name is that it would
only require a change in the default value of the PROMPT2 variable,
so anyone who really hated it could undo it by setting a custom value
for that. Changing the marker would require changing the behavior of
the "%R" prompt escape sequence. (I suppose we could leave %R alone
and invent a new escape that behaves just slightly differently, but
that's probably carrying backwards compatibility too far.)
Also, of course you can experiment with the effects of dropping the
DB name by doing
\set PROMPT2 '%R%# '
After doing a bit of experimentation myself, I think that changing the
marker is a clear win but I'm less sure about dropping the DB name.
I could probably get used to that after awhile, but it's a bit jarring
for a longtime user. On the plus side, there's more screen space for
the long command you're typing.
regards, tom lane
pgsql-hackers by date
|Next:||From: Magnus Hagander||Date: 2011-04-29 15:14:10|
|Subject: Re: Changing the continuation-line prompt in psql?|
|Previous:||From: Mark Reid||Date: 2011-04-29 15:06:39|
|Subject: BUG #5998: CLUSTER and "ERROR: missing chunk number 0 for toast value"|