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

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Nancarrow <gregn4422(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, "David G(dot) Johnston" <david(dot)g(dot)johnston(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-11-29 15:25:04
Message-ID: 3b7689cab8c2d9fb8690226dbead35983c238edc.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 2021-11-29 at 09:43 -0500, Tom Lane wrote:
> Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> writes:
> > There was one other problem mentioned in the original mail, and that
> > seems to be the most serious one to me:
> > [ HISTCONTROL behavior ]
>
> The actual behavior of that option (which perhaps isn't adequately
> documented) is that it suppresses a history entry if the first
> character of the possibly-multi-line entry is a space.  It certainly
> can't operate on a per-line basis, or you'd be likely to lose chunks
> of a single SQL command, so I think that definition is fine as
> it is (ignoring the whole question of whether the feature is sane
> at all ... but if you don't think so, why would you use it?)
>
> Greg's patch would fix this specifically by ensuring that the line
> with the space and comment is treated as a separate history entry.
> So I don't really see that as a separate bug.  Or, if you will,
> the fact that people see it as a bug confirms that such a line
> should be treated as a separate history entry.

Ah, yes. You are right with both the explanation for the behavior
and stating that it points towards treating leading comments as
being seperate from the query.

And, thinking about HISTCONTROL, it does not seem sane in the
context of SQL, and I would never use it.

Yours,
Laurenz Albe

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Arne Roland 2021-11-29 15:48:09 Re: Enforce work_mem per worker
Previous Message Alvaro Herrera 2021-11-29 15:23:46 Re: Correct handling of blank/commented lines in PSQL interactive-mode history