On Wed, 22 Jan 2025 at 08:54, Bruce Momjian <br...@momjian.us> wrote:

> On Sun, Oct 27, 2024 at 09:07:44PM +0100, Tomas Vondra wrote:
> > On 10/27/24 20:03, Tom Lane wrote:
> > > FWIW, I don't observe any particular misbehavior with the very ancient
> > > libedit that macOS ships.  On Fedora 39, I notice something related to
> > > what you say: it seems like the "\q" ending a session gets repeated
> > > into .psql_history by the next session.  I'm surprised that it's not
> > > exactly the same as your results though, because it seems to be the
> > > same source version:
> > >
> > > $ rpm -q libedit
> > > libedit-3.1-53.20240808cvs.fc39.x86_64
> > >
> >
> > That's probably because I usually terminate psql by Ctrl-D, not by
> > typing "\q". But yeah, if I use "\q" it gets added twice.
> >
> > > Didn't try the too-many-lines behavior, but it looks like that
> > > is implemented totally by history_truncate_file(), so if that's
> > > busted it's surely their fault.
> > >
> >
> > Sounds likely. What surprises me a bit, I haven't found any reports of
> > particularly similar bugs ... I'd have expected other people to hit this
> > too, but who knows.
>
> I wonder if our previous libedit workarounds aren't needed anymore and
> are causing the bugs.
>

I'm experiencing a similar behaviour. Indeed adding _HiStOrY_V2_ to the top
of the .psql_history file fixes the issue, until libedit (?) strips it off
again.

---

Rudolph Froger

Reply via email to