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

From: David Fetter <david(at)fetter(dot)org>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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-04 14:10:22
Message-ID: 20100804141022.GC25060@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 02, 2010 at 11:34:02PM -0400, Robert Haas wrote:
> On Mon, Aug 2, 2010 at 11:17 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> >> On Mon, Aug 2, 2010 at 10:49 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Well, it'd still work fine for \e foo. It'll just blow up for \e
> foo 3. My concern isn't really that things that which work now will
> break so much as that this new feature will fail to work for a large
> percentage of the people who try to use it, including virtually
> everyone who tries to use it on Win32.

That concern is a show-stopper.

> >> 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.
> >
> > The other approach we could take is that this whole thing is
> > disabled by default, and you have to set a psql variable
> > EDITOR_LINENUMBER_SWITCH to turn it on.  If you haven't read the
> > documentation enough to find out that variable exists, well, no
> > harm no foul.
>
> That might be reasonable. Right now the default behavior is to do
> +line on Linux and /line on Windows. But maybe a more sensible
> default would be to fail with an error message that says "you have
> to set thus-and-so variable if you want to use this feature". That
> seems better than sometimes working and sometimes failing depending
> on what editor the user has configured.
>
> A side question is whether this should be an environment variable or
> a psql variable.

I'd say "yes." As with $EDITOR/PSQL_EDITOR, there should be something
that looks for an overriding psql variable, drops through to look for
an environment variable, and then to a sane default, for some
reasonable value of "sane." Perhaps this default could depend on OS
(Windows vs. Everything Else) to start with.

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-08-04 14:29:44 Re: review: psql: edit function, show function commands patch
Previous Message Marko Tiikkaja 2010-08-04 14:08:49 Re: Proposal / proof of concept: Triggers on VIEWs