pgsql: Make psql redisplay the query buffer after \e. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Make psql redisplay the query buffer after \e.
Date
Msg-id E1iYH5t-0004Rs-TH@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Make psql redisplay the query buffer after \e.

Up to now, whatever you'd edited was put back into the query buffer
but not redisplayed, which is less than user-friendly.  But we can
improve that just by printing the text along with a prompt, if we
enforce that the editing result ends with a newline (which it
typically would anyway).  You then continue typing more lines if
you want, or you can type ";" or do \g or \r or another \e.

This is intentionally divorced from readline's processing,
for simplicity and so that it works the same with or without
readline enabled.  We discussed possibly integrating things
more closely with readline; but that seems difficult, uncertainly
portable across different readline and libedit versions, and
of limited real benefit anyway.  Let's try the simple way and
see if it's good enough.

Patch by me, thanks to Fabien Coelho and Laurenz Albe for review

Discussion: https://postgr.es/m/13192.1572318028@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d1c866e57f1156000a51ff7e26590984d32bab53

Modified Files
--------------
doc/src/sgml/ref/psql-ref.sgml | 16 +++++++++++-----
src/bin/psql/command.c         |  3 ++-
src/bin/psql/mainloop.c        | 20 ++++++++++++++++++++
3 files changed, 33 insertions(+), 6 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Avoid taking a new snapshot for an immutable simple expression i
Next
From: Joe Conway
Date:
Subject: pgsql: Add object TRUNCATE hook