Re: Correct handling of blank/commented lines in PSQL interactive-mode history

Alvaro Herrera <alvherre@alvh.no-ip.org>

From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: "David G. Johnston" <david.g.johnston@gmail.com>, Greg Nancarrow <gregn4422@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2021-09-07T00:28:53Z
Lists: pgsql-hackers
On 2021-Sep-06, Laurenz Albe wrote:

> I agree with Greg that the current behavior is annoying and would
> welcome the change.  This has bothered me before.

It has bothered me too.  I am particularly bothered by the uselessness
that M-# results in -- namely, inserting a # at the start of the buffer.
This is quite useless: in bash, the # starts a comment, so M-# makes the
entry a comment; but in psql it doesn't have that effect.  If somebody
were to make M-# make the buffer a /* ... */ comment, it would become
quite handy.

-- 
Álvaro Herrera           39°49'30"S 73°17'W  —  https://www.EnterpriseDB.com/



Commits

  1. psql: initialize comment-begin setting to a useful value by default.

  2. psql: treat "--" comments between queries as separate history entries.

  3. psql: include intra-query "--" comments in what's sent to the server.