pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #17020: meta command psql \reset does not clear the query buffer
5+ messages / 5 participants
[nested] [flat]

* BUG #17020: meta command psql \reset does not clear the query buffer
@ 2021-05-18 22:16  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 2 replies; 5+ messages in thread

From: PG Bug reporting form @ 2021-05-18 22:16 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: francois.grandvarlet@wanadoo.fr

The following bug has been logged on the website:

Bug reference:      17020
Logged by:          François Grandvarlet
Email address:      francois.grandvarlet@wanadoo.fr
PostgreSQL version: 13.3
Operating system:   Centos 7
Description:        

Connected via psql
issuing a command like : SELECT * FROM generate_series (1, 1000);
meta command \p shows the query buffer
meta command \reset tells "Query buffer reset (cleared)."
but meta command \p still shows the query buffer and meta command \g execute
the query
Is this the normal behavior ?
It seems to me that the query buffer should be empty after issuing \reset



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

* Re: BUG #17020: meta command psql \reset does not clear the query buffer
@ 2021-05-19 14:39  Bruce Momjian <bruce@momjian.us>
  parent: PG Bug reporting form <noreply@postgresql.org>
  1 sibling, 1 reply; 5+ messages in thread

From: Bruce Momjian @ 2021-05-19 14:39 UTC (permalink / raw)
  To: francois.grandvarlet@wanadoo.fr; pgsql-bugs@lists.postgresql.org

On Tue, May 18, 2021 at 10:16:16PM +0000, PG Bug reporting form wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      17020
> Logged by:          François Grandvarlet
> Email address:      francois.grandvarlet@wanadoo.fr
> PostgreSQL version: 13.3
> Operating system:   Centos 7
> Description:        
> 
> Connected via psql
> issuing a command like : SELECT * FROM generate_series (1, 1000);
> meta command \p shows the query buffer
> meta command \reset tells "Query buffer reset (cleared)."
> but meta command \p still shows the query buffer and meta command \g execute
> the query
> Is this the normal behavior ?
> It seems to me that the query buffer should be empty after issuing \reset

I was recently confused by this too, but the psql \print documentation
clarified it for me:

       \p or \print
           Print the current query buffer to the standard output. If the
-->        current query buffer is empty, the most recently executed query is
-->        printed instead.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  If only the physical world exists, free will is an illusion.






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

* Re: BUG #17020: meta command psql \reset does not clear the query buffer
@ 2021-05-19 14:42  Tom Lane <tgl@sss.pgh.pa.us>
  parent: PG Bug reporting form <noreply@postgresql.org>
  1 sibling, 0 replies; 5+ messages in thread

From: Tom Lane @ 2021-05-19 14:42 UTC (permalink / raw)
  To: francois.grandvarlet@wanadoo.fr; +Cc: pgsql-bugs@lists.postgresql.org

PG Bug reporting form <noreply@postgresql.org> writes:
> issuing a command like : SELECT * FROM generate_series (1, 1000);
> meta command \p shows the query buffer
> meta command \reset tells "Query buffer reset (cleared)."
> but meta command \p still shows the query buffer and meta command \g execute
> the query
> Is this the normal behavior ?

Yes.  \p is documented as

    Print the current query buffer to the standard output. If the current
    query buffer is empty, the most recently executed query is printed
    instead.

and \g likewise says "If the current query buffer is empty, the most
recently sent query is re-executed instead".

> It seems to me that the query buffer should be empty after issuing \reset

It is.  If you now type something, that something is a new command that's
not concatenated with what you typed before.

			regards, tom lane





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

* RE: BUG #17020: meta command psql \reset does not clear the query buffer
@ 2021-05-19 15:23  francois.grandvarlet@wanadoo.fr
  parent: Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 5+ messages in thread

From: francois.grandvarlet@wanadoo.fr @ 2021-05-19 15:23 UTC (permalink / raw)
  To: 'Bruce Momjian' <bruce@momjian.us>; pgsql-bugs@lists.postgresql.org

Thank you very much for your answer and your explanations.
I should have read the doc more carefully.

Best regards,
François Grandvarlet

-----Message d'origine-----
De : Bruce Momjian <bruce@momjian.us> 
Envoyé : mercredi 19 mai 2021 16:40
À : francois.grandvarlet@wanadoo.fr; pgsql-bugs@lists.postgresql.org
Objet : Re: BUG #17020: meta command psql \reset does not clear the query
buffer

On Tue, May 18, 2021 at 10:16:16PM +0000, PG Bug reporting form wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      17020
> Logged by:          François Grandvarlet
> Email address:      francois.grandvarlet@wanadoo.fr
> PostgreSQL version: 13.3
> Operating system:   Centos 7
> Description:        
> 
> Connected via psql
> issuing a command like : SELECT * FROM generate_series (1, 1000); meta 
> command \p shows the query buffer meta command \reset tells "Query 
> buffer reset (cleared)."
> but meta command \p still shows the query buffer and meta command \g 
> execute the query Is this the normal behavior ?
> It seems to me that the query buffer should be empty after issuing 
> \reset

I was recently confused by this too, but the psql \print documentation
clarified it for me:

       \p or \print
           Print the current query buffer to the standard output. If the
-->        current query buffer is empty, the most recently executed query
is
-->        printed instead.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  If only the physical world exists, free will is an illusion.






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

* Re: BUG #17020: meta command psql \reset does not clear the query buffer
@ 2021-05-20 18:29  'Bruce Momjian' <bruce@momjian.us>
  parent: francois.grandvarlet@wanadoo.fr
  0 siblings, 0 replies; 5+ messages in thread

From: Bruce Momjian @ 2021-05-20 18:29 UTC (permalink / raw)
  To: francois.grandvarlet@wanadoo.fr; +Cc: pgsql-bugs@lists.postgresql.org

On Wed, May 19, 2021 at 05:23:06PM +0200, francois.grandvarlet@wanadoo.fr wrote:
> Thank you very much for your answer and your explanations.
> I should have read the doc more carefully.

For me the confusing part is the psql \? doesn't mention this behavior.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  If only the physical world exists, free will is an illusion.






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


end of thread, other threads:[~2021-05-20 18:29 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 22:16 BUG #17020: meta command psql \reset does not clear the query buffer PG Bug reporting form <noreply@postgresql.org>
2021-05-19 14:39 ` Bruce Momjian <bruce@momjian.us>
2021-05-19 15:23   ` francois.grandvarlet@wanadoo.fr
2021-05-20 18:29     ` 'Bruce Momjian' <bruce@momjian.us>
2021-05-19 14:42 ` 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