pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve psql's behavior when the editor is exited without saving
Date: Sat, 03 Apr 2021 21:38:39 +0000
Message-ID: <E1lSnyZ-0005jP-1j@gemulon.postgresql.org> (raw)

Improve psql's behavior when the editor is exited without saving.

When editing the previous query buffer, if the editor is exited
without modifying the temp file then clear the query buffer,
rather than re-loading (and probably re-executing) the previous
query buffer.  This reduces the probability of accidentally
re-executing something you didn't intend to.

Similarly, in "\e file", if the file isn't actually modified
then don't load it into the query buffer.  And in "\ef" and
"\ev", if no changes are made then clear the query buffer
instead of loading the function or view definition into it.

Cases where we fail to invoke the editor at all, or it returns
a nonzero status, are treated like the no-file-modification case.

Laurenz Albe, reviewed by Jacob Champion

Discussion: https://postgr.es/m/0ba3f2a658bac6546d9934ab6ba63a805d46a49b.camel@cybertec.at

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/55873a00e3c3349664e7215077dca74ccea08b4d

Modified Files
--------------
doc/src/sgml/ref/psql-ref.sgml | 10 ++++--
src/bin/psql/command.c         | 74 +++++++++++++++++++++++++++++++++---------
2 files changed, 66 insertions(+), 18 deletions(-)



Message-ID: <E1lSnyZ-0005jP-1j@gemulon.postgresql.org>
Permalink:  ../E1lSnyZ-0005jP-1j@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lSnyZ-0005jP-1j@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Improve psql's behavior when the editor is exited without saving
  In-Reply-To: <E1lSnyZ-0005jP-1j@gemulon.postgresql.org>
  References: <E1lSnyZ-0005jP-1j@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox