Re: BUG #17020: meta command psql \reset does not clear the query buffer

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: francois(dot)grandvarlet(at)wanadoo(dot)fr
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17020: meta command psql \reset does not clear the query buffer
Date: 2021-05-19 14:42:39
Message-ID: 3429977.1621435359@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Jakub Palenik 2021-05-19 14:44:01 Jsonb gets extra quotes when returned from a function that break json format
Previous Message Bruce Momjian 2021-05-19 14:42:11 Re: BUG #17023: wal_log_hints not configured even if it on