From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Changing the continuation-line prompt in psql? |
Date: | 2011-04-29 15:09:58 |
Message-ID: | 5467.1304089798@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Over at
http://archives.postgresql.org/pgsql-novice/2011-04/msg00102.php
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
postgres=>
postgres->
is on the subtle side. Two different possible changes were suggested:
* Drop the database name from PROMPT2, so you see
postgres=>
->
* Change the continuation-line marker from "-" to "+", so you see
postgres=>
postgres+>
We could do either or both of these. If we did both it'd look like
postgres=>
+>
"+" 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.
Thoughts?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2011-04-29 15:14:10 | Re: Changing the continuation-line prompt in psql? |
Previous Message | Mark Reid | 2011-04-29 15:06:39 | BUG #5998: CLUSTER and "ERROR: missing chunk number 0 for toast value" |