Re: Confusing behavior of psql's \e - Mailing list pgsql-hackers

From Chapman Flack
Subject Re: Confusing behavior of psql's \e
Date
Msg-id 5FC6708B.4000303@anastigmatix.net
Whole thread Raw
In response to Re: Confusing behavior of psql's \e  (Laurenz Albe <laurenz.albe@cybertec.at>)
Responses Re: Confusing behavior of psql's \e
List pgsql-hackers
On 12/01/20 11:21, Laurenz Albe wrote:
> On Tue, 2020-12-01 at 11:03 -0500, Chapman Flack wrote:
>>> complain about it, so I propose to clear the query buffer if the
>>> editor exits without modifying the file.
>>
>> Or how about keeping the query buffer content unchanged, but not
>> executing it? Then it's still there if you have another idea about
>> editing it. It's easy enough to \r if you really want it gone.
> 
> What if the buffer was empty?  Would you want to get the previous
> query in the query buffer?  I'd assume not...

I took your proposal to be specifically about what happens if the editor
is exited with no change to the buffer, and in that case, I would suggest
making no change to the buffer, but not re-executing it.

If the editor is exited after deliberately emptying the editor buffer,
I would expect that to be treated as emptying the query buffer.

I don't foresee any case that would entail bringing a /previous/ query
back into the query buffer.

Regards,
-Chap



pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: Add session statistics to pg_stat_database
Next
From: "Zidenberg, Tsahi"
Date:
Subject: Re: Improving spin-lock implementation on ARM.