Re: [PATCH] "\ef " in psql - Mailing list pgsql-hackers

From Brendan Jurd
Subject Re: [PATCH] "\ef " in psql
Date
Msg-id 37ed240d0809051943h1acb62a9jf457f4c0341f3d23@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] "\ef " in psql  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PATCH] "\ef " in psql  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sat, Sep 6, 2008 at 10:10 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> * the way you had it set up, the CREATE OR REPLACE FUNCTION command
> would be sent to the backend instantaneously upon return from the
> editor, with no opportunity for the user to decide he didn't want his
> changes applied.  This seemed unacceptably dangerous to me.  I changed
> the exit code to PSQL_CMD_NEWEDIT instead of PSQL_CMD_SEND, which causes
> the command to wait in the query buffer.

The principle of least astonishment suggests that \ef should behave in
the same way as \e.

With \e (which I use a lot), the command(s) are immediately executed
by the backend as soon as you write and exit from the editor.  I don't
find that dangerous, and anyone who uses \e will already be very much
accustomed to it.  If \ef did something different, it would just be
weird.

If you're not sure you want to execute the contents of your \e editor
session after all, you can always delete the semicolon, or everything
in the file, before quitting.

Cheers,
BJ


pgsql-hackers by date:

Previous
From: Euler Taveira de Oliveira
Date:
Subject: Re: PostgreSQL SSL problem
Next
From: Bruce Momjian
Date:
Subject: Re: New FSM allocation policy