Re: Correct handling of blank/commented lines in PSQL interactive-mode history - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Correct handling of blank/commented lines in PSQL interactive-mode history
Date
Msg-id 3209109.1631040651@sss.pgh.pa.us
Whole thread Raw
In response to Re: Correct handling of blank/commented lines in PSQL interactive-mode history  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: Correct handling of blank/commented lines in PSQL interactive-mode history  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: CI/windows docker vs "am a service" autodetection on windows
Next
From: Andres Freund
Date:
Subject: Re: CI/windows docker vs "am a service" autodetection on windows