psql \r command is working?
Hello
Is psql command \r actually works? I expected \r and then \e command should start editor without text of last query.
LANG=C EDITOR=cat psql
psql (11.5 (Debian 11.5-1.pgdg100+1))
Type "help" for help.
melkij=> select 1;
?column?
----------
1
(1 row)
melkij=> \r
Query buffer reset (cleared).
melkij=> \e
select 1;
?column?
----------
1
(1 row)
Buffer is still here, in normal external editors too.
Same test on REL9_6_STABLE:
postgres=# select 1;
?column?
----------
1
(1 row)
postgres=# \r
Query buffer reset (cleared).
postgres=# \e
Buffer was actually cleared.
I see this behavior change on >= 10 versions
regards, Sergei
Sergei Kornilov <sk@zsrv.org> writes:
Is psql command \r actually works? I expected \r and then \e command should start editor without text of last query.
\r clears the current query buffer. \e without an argument is
defined to edit the current query buffer, or if that is empty,
the last query. I don't see anything particularly wrong here.
I see this behavior change on >= 10 versions
Possibly fixed as a side effect of e984ef586.
regards, tom lane