Re: Correct handling of blank/commented lines in PSQL interactive-mode history
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>,
"David G. Johnston" <david.g.johnston@gmail.com>,
Greg Nancarrow <gregn4422@gmail.com>,
PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2021-09-07T18:50:51Z
Lists: pgsql-hackers
Alvaro Herrera <alvherre@alvh.no-ip.org> writes: > 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'm not here to claim that the current behavior is perfect. However, AFAICT the patch as-presented breaks the principle that text goes into the history at the moment it's sent to the server. In particular, we might make an entry for text that *never* got to the server because you cleared the buffer instead. I don't find that to be an improvement. It breaks one of the primary use-cases for history, ie keeping a record of what you did. We could perhaps finesse that point by deciding that comment lines that are handled this way will never be sent to the server --- but I'm sure people will complain about that, too. I've definitely heard people complain because "--" comments are stripped from what's sent (so I'd look favorably on a patch to undo that). I think the questions around empty-line handling are largely orthogonal to this, and we'll just confuse ourselves if we discuss that at the same time. Likewise for M-#. regards, tom lane
Commits
-
psql: initialize comment-begin setting to a useful value by default.
- 3d858af07ee6 15.0 landed
-
psql: treat "--" comments between queries as separate history entries.
- c2f654930e9f 15.0 landed
-
psql: include intra-query "--" comments in what's sent to the server.
- 83884682f4df 15.0 landed