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

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Greg Nancarrow <gregn4422(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Correct handling of blank/commented lines in PSQL interactive-mode history
Date: 2021-09-06 16:02:45
Message-ID: 438c7a2145f25cf2b21e214ed4b203e1cf6cf635.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 2021-09-06 at 07:50 -0700, David G. Johnston wrote:
> On Mon, Sep 6, 2021 at 7:13 AM Greg Nancarrow <gregn4422(at)gmail(dot)com> wrote:
> > I've attached a patch that corrects the behaviour.
> > For the type of lines mentioned, the patch makes the history behave
> > more like Bash history.
>
> I have my doubts that you've really fixed anything here since Bash is a
> line-oriented shell while psql is a statement-oriented one.  This is a feature.
> What you are observing is, I think, a side-effect of that fact that
> comments cannot terminate statements.  That seems reasonable.
> In short, your BEFORE results make sense and don't require fixing.

I think that psql's behavior should be governed more by usefulness than
by consideratoins like "comments cannot terminate statements".

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

That multi-line statements that contain a line with a space are omitted
from the history when HISTCONTROL is set to "ignorespace" seems like
a bug to me.

So +1 on the idea of the patch, although I didn't scrutinize the
implementation.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-09-06 16:03:32 Re: Timeout failure in 019_replslot_limit.pl
Previous Message Rahila Syed 2021-09-06 15:55:42 Re: Column Filtering in Logical Replication