pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedpsql \r changed behavior in pg10
4+ messages / 3 participants
[nested] [flat]
* psql \r changed behavior in pg10
@ 2020-07-23 00:01 Emanuel Araújo <eacshm@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Emanuel Araújo @ 2020-07-23 00:01 UTC (permalink / raw)
To: pgsql-general
Hi,
When used PostgreSQL 9.6.* it was common use in psql \r\e to clear a buffer
query and open the empty text editor. Works fine for me and it was very
useful in my tasks.
Since PostgreSQL 10, this behavior changed and not more clear the
buffer query.
psql helps show that \r reset (clear) the query buffer but in practice
don't work or I do not understand how would work.
Example using postgrsql 11.8 :
select 1;
\e
-> Open temp file with a last statement "select 1;"
exit text editor and run command. It's ok.
\r
\e
-> Open temp file with the same last command "select 1;"
is it right?
--
*Regards,Emanuel Araújo*
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: psql \r changed behavior in pg10
@ 2020-07-23 00:14 David G. Johnston <david.g.johnston@gmail.com>
parent: Emanuel Araújo <eacshm@gmail.com>
0 siblings, 2 replies; 4+ messages in thread
From: David G. Johnston @ 2020-07-23 00:14 UTC (permalink / raw)
To: Emanuel Araújo <eacshm@gmail.com>; +Cc: pgsql-general
On Wednesday, July 22, 2020, Emanuel Araújo <eacshm@gmail.com> wrote:
>
> \r
> \e
> -> Open temp file with the same last command "select 1;"
> is it right?
>
>
Documentation since v10:
Or, if the current query buffer is empty, the most recently executed query
is copied to a temporary file and edited in the same fashion.
David J.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: psql \r changed behavior in pg10
@ 2020-07-23 00:36 David G. Johnston <david.g.johnston@gmail.com>
parent: David G. Johnston <david.g.johnston@gmail.com>
1 sibling, 0 replies; 4+ messages in thread
From: David G. Johnston @ 2020-07-23 00:36 UTC (permalink / raw)
To: Emanuel Araújo <eacshm@gmail.com>; +Cc: pgsql-general
On Wednesday, July 22, 2020, David G. Johnston <david.g.johnston@gmail.com>
wrote:
> On Wednesday, July 22, 2020, Emanuel Araújo <eacshm@gmail.com> wrote:
>
>>
>> \r
>> \e
>> -> Open temp file with the same last command "select 1;"
>> is it right?
>>
>>
> Documentation since v10:
>
> Or, if the current query buffer is empty, the most recently executed query
> is copied to a temporary file and edited in the same fashion.
>
I believe \e is now working as intended but assuming it worked differently
in 9.6 the behavior change did not get noticed and so no release note entry
was added for it. Adding the new \if meta commands in v10 resulted in
reworking of the code probably causing this to change. We fixed the docs
to match the expected behavior which was seen in v10 when the doc patch was
written.
https://github.com/postgres/postgres/commit/e984ef5861df4bc9733b36271d05763e82de7c04
David J.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: psql \r changed behavior in pg10
@ 2020-07-23 00:54 Tom Lane <tgl@sss.pgh.pa.us>
parent: David G. Johnston <david.g.johnston@gmail.com>
1 sibling, 0 replies; 4+ messages in thread
From: Tom Lane @ 2020-07-23 00:54 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: Emanuel Araújo <eacshm@gmail.com>; pgsql-general
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Wednesday, July 22, 2020, Emanuel Araújo <eacshm@gmail.com> wrote:
>> \r
>> \e
>> -> Open temp file with the same last command "select 1;"
>> is it right?
> Documentation since v10:
> Or, if the current query buffer is empty, the most recently executed query
> is copied to a temporary file and edited in the same fashion.
There's some discussion around that in this thread:
https://www.postgresql.org/message-id/flat/9b4ea968-753f-4b5f-b46c-d7d3bf7c8f90%40manitou-mail.org
The key point is that \r in this case used to clear the "previous query"
buffer since there was nothing for it to remove from the "current query"
buffer. I argued then that that was confusing and counterproductive,
and I still think that.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2020-07-23 00:54 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-07-23 00:01 psql \r changed behavior in pg10 Emanuel Araújo <eacshm@gmail.com>
2020-07-23 00:14 ` David G. Johnston <david.g.johnston@gmail.com>
2020-07-23 00:36 ` David G. Johnston <david.g.johnston@gmail.com>
2020-07-23 00:54 ` Tom Lane <tgl@sss.pgh.pa.us>
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