Re: review: psql: edit function, show function commands patch

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Jan Urbański <wulczer(at)wulczer(dot)org>, Postgres - Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: review: psql: edit function, show function commands patch
Date: 2010-08-03 03:10:27
Message-ID: AANLkTi=9omRJcaKbSg=LrVY3q8oaVNygxPzKu6PSmL1z@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 2, 2010 at 10:49 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> This is actually my biggest concern about this patch - that it may be
>> just too much of a hassle to actually make it work for people.  I just
>> tried setting $EDITOR to MacOS's TextEdit program, and it turns out
>> that TextEdit doesn't understand +.  I'm afraid that we're going to
>> end up with a situation where it only works for people using emacs or
>> vi, and everyone else ends up with a broken install (and, possibly, no
>> clear idea how to fix it).
>
> [ disclaimer: I've not looked at the proposed patch yet ]
>
> It seems like this ought to be fairly easily surmountable as long as
> the patch is designed for failure.

It isn't.

> The fallback position is just that
> the line number does nothing, ie \ef foo just opens the editor and
> doesn't try to position the cursor anywhere special; nobody can complain
> about that because it's no worse than before.  What we need is to not
> try to force positioning if we don't recognize the editor.

Supposing for the moment that we could make it work that way, that
would be reasonable.

> I'm tempted
> to suggest forgetting about any user-configurable parameter and just
> provide code that strcmp's the $EDITOR value to see if it recognizes the
> editor name, otherwise do nothing.

With all due respect, that sounds like an amazingly bad idea. Surely,
we'll be forever getting patches to add $MYFAVORITEEDITOR to the list,
or complaints that it's not already included. While this is
superficially a Nice Thing to Have and I would certainly support it if
+linenumber were relatively universal, it's really a pretty minor
convenience when you come right down to it, and I am not at all
convinced it is worth the hassle of trying to divine what piece of
syntax will equip the user's choice of editor with the necessary
amount of clue.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2010-08-03 03:16:01 Re: (9.1) btree_gist support for searching on "not equals"
Previous Message Tom Lane 2010-08-03 02:49:38 Re: review: psql: edit function, show function commands patch