pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #15002: Unexpected behaviour in psql \r command
3+ messages / 3 participants
[nested] [flat]

* BUG #15002: Unexpected behaviour in psql \r command
@ 2018-01-09 17:45 PG Bug reporting form <noreply@postgresql.org>
  2018-01-09 17:58 ` Re: BUG #15002: Unexpected behaviour in psql \r command David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Bug reporting form @ 2018-01-09 17:45 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: pkorobeinikov@gmail.com

The following bug has been logged on the website:

Bug reference:      15002
Logged by:          Petr Korobeinikov
Email address:      pkorobeinikov@gmail.com
PostgreSQL version: 10.0
Operating system:   Any (reproduced in macOS Sierra, Slackware)
Description:        

Dear hackers!

Unexpected behaviour of \r subcommand has been introduced in 10.0
(e984ef5861df4bc9733b36271d05763e82de7c04).

Previously (at least in 9.6) previous_buf hasn’t been used for any kinds of
\e subcommand.
Now if query_buf is empty previous buffer contents is used.

It makes useless \r subcommand in cases when clean buffer required in next
\e.
Multiple calls of \r takes no effect.

Code snippet:
```
794 +
795 +               /* Applies to previous query if current buffer is empty
*/
796 +               copy_previous_query(query_buf, previous_buf);
797 +
798                 if (do_edit(fname, query_buf, lineno, NULL))
799                     status = PSQL_CMD_NEWEDIT;
```



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #15002: Unexpected behaviour in psql \r command
  2018-01-09 17:45 BUG #15002: Unexpected behaviour in psql \r command PG Bug reporting form <noreply@postgresql.org>
@ 2018-01-09 17:58 ` David G. Johnston <david.g.johnston@gmail.com>
  2018-01-11 08:44   ` Re: BUG #15002: Unexpected behaviour in psql \r command Petr Korobeinikov <pkorobeinikov@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: David G. Johnston @ 2018-01-09 17:58 UTC (permalink / raw)
  To: Petr Korobeinikov <pkorobeinikov@gmail.com>; pgsql-bugs@lists.postgresql.org

On Tue, Jan 9, 2018 at 10:45 AM, PG Bug reporting form <
noreply@postgresql.org> wrote:

> Previously (at least in 9.6) previous_buf hasn’t been used for any kinds of
> \e subcommand.
> Now if query_buf is empty previous buffer contents is used.
>

​IIUC the complaint is that it is no longer possible to use \edit​ to
generate a completely empty temporary query that can then be written from
scratch.

The v10 behavior is desirable so that leaves either learning a new idiom to
accomplish your goal or adding something like "\edit -" to explicitly
invoke the desired behavior.

Doing:

# SELECT <enter>
# \edit

Seems reasonably straight forward to get a editor for a newly query instead
of the previous one.

David J.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #15002: Unexpected behaviour in psql \r command
  2018-01-09 17:45 BUG #15002: Unexpected behaviour in psql \r command PG Bug reporting form <noreply@postgresql.org>
  2018-01-09 17:58 ` Re: BUG #15002: Unexpected behaviour in psql \r command David G. Johnston <david.g.johnston@gmail.com>
@ 2018-01-11 08:44   ` Petr Korobeinikov <pkorobeinikov@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Petr Korobeinikov @ 2018-01-11 08:44 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: pgsql-bugs@lists.postgresql.org

In this case \r subcommand seems to be completely useless.
It does absolutely nothing.

2018-01-09 20:58 GMT+03:00 David G. Johnston <david.g.johnston@gmail.com>:

> On Tue, Jan 9, 2018 at 10:45 AM, PG Bug reporting form <
> noreply@postgresql.org> wrote:
>
>> Previously (at least in 9.6) previous_buf hasn’t been used for any kinds
>> of
>> \e subcommand.
>> Now if query_buf is empty previous buffer contents is used.
>>
>
> ​IIUC the complaint is that it is no longer possible to use \edit​ to
> generate a completely empty temporary query that can then be written from
> scratch.
>
> The v10 behavior is desirable so that leaves either learning a new idiom
> to accomplish your goal or adding something like "\edit -" to explicitly
> invoke the desired behavior.
>
> Doing:
>
> # SELECT <enter>
> # \edit
>
> Seems reasonably straight forward to get a editor for a newly query
> instead of the previous one.
>
> David J.
>
>

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2018-01-11 08:44 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-01-09 17:45 BUG #15002: Unexpected behaviour in psql \r command PG Bug reporting form <noreply@postgresql.org>
2018-01-09 17:58 ` David G. Johnston <david.g.johnston@gmail.com>
2018-01-11 08:44   ` Petr Korobeinikov <pkorobeinikov@gmail.com>

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