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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Greg Nancarrow <gregn4422(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Correct handling of blank/commented lines in PSQL interactive-mode history
Date: 2021-09-07 18:50:51
Message-ID: 3209109.1631040651@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2021-09-07 19:03:14 Re: CI/windows docker vs "am a service" autodetection on windows
Previous Message Andres Freund 2021-09-07 18:49:25 Re: CI/windows docker vs "am a service" autodetection on windows