Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...

From: Kirk Wolak <wolakk(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...
Date: 2022-11-24 04:26:03
Message-ID: CACLU5mQvsAtPaYqjGEnj_w1AgXjJsYXeXvLtUvznKnfpec2k8w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Nov 23, 2022 at 9:32 PM Andres Freund <andres(at)anarazel(dot)de> wrote:

> Hi,
>
> On 2022-11-23 20:55:18 -0500, Kirk Wolak wrote:
> > Currently I have a lot of it working, but I need to partner up with some
> of
> > the meson guys...
> > if it is already close to working, a couple of my tweaks could accelerate
> > it.
>
> I just successfully compiled postgres with meson and readline, using msvc,
> only tweaking psql_completion() contents.
>
> The readline I used for building with msvc is from
> vcpkg.exe install --triplet x64-windows readline-win32 pkgconf
> ...
> # when running tests, the readline dll needs to be somewhere in PATH
> $ENV:PATH="$ENV:PATH;c:/dev/vcpkg/installed/x64-windows/debug/bin"
>
> Greetings,
>
> Andres Freund
>
Andres,
Thank you for this. I Will dig into it.

A note on using readline.dll... We have to be careful, this was one of
the issues I had.
Readline uses it's own xmalloc() to allocate the line, and in our mainloop,
we get that as "line",
and then we call free(line); which triggered Assertion Failures. I've
always thought it was not a
great pattern to allocate inside the DLL and free inside the application,
unless you can
make sure you use the DLL to also do the free.

I think it would be easy to be mismatched.

Regards Kirk

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Kirk Wolak 2022-11-24 04:38:32 Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...
Previous Message Tom Lane 2022-11-24 02:57:30 Re: Getting PSQL in Windows to support TAB/Autocomplete via modified readline...