Re: Not so happy with psql's new multiline behavior - Mailing list pgsql-hackers

From mark@mark.mielke.cc
Subject Re: Not so happy with psql's new multiline behavior
Date
Msg-id 20060304180715.GA16722@mark.mielke.cc
Whole thread Raw
In response to Not so happy with psql's new multiline behavior  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Not so happy with psql's new multiline behavior
List pgsql-hackers
On Sat, Mar 04, 2006 at 12:08:25PM -0500, Tom Lane wrote:
> Comments?

I generally do not use psql in this manner, because I've found it
to be annoying before the change. After the change, from what you
describe, I too would find it annoying still.

For me, I prefer the interactive behaviour of ZSH. Multiline
statements remain as multiline statements, as they were typed.
One can navigate up and down through the multiline statement
to make alterations. The real beauty of this approach comes up
when doing something such as defining a function. Would you
LOVE the ability to edit the function, in the original form,
as originally typed, allowing you to insert text, and even
newlines into the middle? Effectively you have have a full
text editor, for the last complete series of lines.

Too hard to implement? :-)

To check it out, try /bin/zsh (it seems to come with Linux and
Solaris these days), and type out:
   $ bindkey -e         # Emacs key bindings
   $ f()   > {   >     a   > }
   $ f   f:2: command not found: a

Oh no. We typed the wrong command in. It isn't 'a' we want. We want 'ls'.

Hit up-arrow twice, and we get (_ = cursor)
   $ f()   {       a   }_

Let's go change 'a'. up arrow, Control-E (end-of-line):
   $ f()   {       a_   }

Then, backspace, ls:
   $ f()   {       ls_   }

Then enter:
   $ _

Done.

Saved me lots of time. I write very complex functions, directly with
the line editor. If I make a mistake, I go back and change it.

Without this sort of thing, I end up storing my functions to a text
editor window, and cut + pasting back and forth. In fact, that is what
I do with psql today. I have a text editor with a record of all my
statements, because psql line editting sucks.

Just an opinion.

Cheers,
mark

-- 
mark@mielke.cc / markm@ncf.ca / markm@nortel.com     __________________________
.  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Neighbourhood Coder
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | 
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario, Canada
 One ring to rule them all, one ring to find them, one ring to bring them all                      and in the darkness
bindthem...
 
                          http://mark.mielke.cc/



pgsql-hackers by date:

Previous
From: Charlie Savage
Date:
Subject: Re: Building Windows Server Extensions Using VC++ 2005
Next
From: Rod Taylor
Date:
Subject: Constraint Exclusion and Partition Locking