Re: Not so happy with psql's new multiline behavior

From: mark(at)mark(dot)mielke(dot)cc
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Not so happy with psql's new multiline behavior
Date: 2006-03-04 18:07:15
Message-ID: 20060304180715.GA16722@mark.mielke.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)mielke(dot)cc / markm(at)ncf(dot)ca / markm(at)nortel(dot)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 bind them...

http://mark.mielke.cc/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2006-03-04 18:16:25 Constraint Exclusion and Partition Locking
Previous Message Charlie Savage 2006-03-04 17:35:59 Re: Building Windows Server Extensions Using VC++ 2005