Copy/paste from psql - was: Changing the continuation-line prompt in psql?
On Fri, Apr 29, 2011 at 8:11 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Greg Stark <gsstark@mit.edu> writes:
On Fri, Apr 29, 2011 at 5:45 PM, Christopher Browne <cbbrowne@gmail.com> wrote:
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 would second this precise interest. It really annoys me more often
than anything else that when I try to copy/paste an sql query I need
to copy each line one by one. It would be different from MySql but I
think it would be even clearer to the user:postgres=> select 1,
/*line 2:*/ 2,
/*line 3:*/ 3;This looks promising until you stop to think about either string
literals or /* comment blocks being continued across lines ...
The copy paste problem also frustrates me, maybe modifying the prompt
isn't an effective answer though.
Extending the history command (\s) sounds more promising
\s- for a reverse ordered history
\s[n] for the last n or n-from-last-th (\s1 different from \p in that
it shows the last completed query not the one in progress)
and most importantly showing full history through a less-style
interface like large result sets rather than in the flow of psql
Does that sound like a workable answer?
Regards,
Bell.
Excerpts from Alastair Turner's message of sáb abr 30 05:10:40 -0300 2011:
Extending the history command (\s) sounds more promising
\s- for a reverse ordered history
\s[n] for the last n or n-from-last-th (\s1 different from \p in that
it shows the last completed query not the one in progress)and most importantly showing full history through a less-style
interface like large result sets rather than in the flow of psql
I agree that \s needs a bit of a whack, regardless of anything done to
the prompts.
--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support