Thread: psql on Windows systems

psql on Windows systems

From
Holger Jakobs
Date:
Dear friends,

Recently I had to use PostgreSQL on a Windows based system, and I was 
surprised that the psql tool behaves differently, when it comes to the 
functionality of the readline library.

There is no tab-completion for commands or schema/view/table names. 
Also, browsing through previous commands within the history is different 
from the psql version on Linux systems. Only single lines, not complete 
commands show up in the history.

This may be due to some library differences, but wouldn't it be possible 
to link some powerful readline and tab-completion libraries also on 
Windows systems?

Maybe it's a question for psql developers, should I write on a different 
list?

Kind Regards,

Holger

-- 

Holger Jakobs, Bergisch Gladbach




Re: psql on Windows systems

From
Tom Lane
Date:
Holger Jakobs <holger@jakobs.com> writes:
> Recently I had to use PostgreSQL on a Windows based system, and I was 
> surprised that the psql tool behaves differently, when it comes to the 
> functionality of the readline library.

Yeah, readline doesn't exist for Windows last I heard.  At least,
we don't try to build with it there.

            regards, tom lane



Re: psql on Windows systems

From
Zaid Shabbir
Date:
On which windows platform you are 

Have you face the same behaviour with the windows installer ?

On Fri, 5 Jul 2024 at 11:21 PM, Holger Jakobs <holger@jakobs.com> wrote:
Dear friends,

Recently I had to use PostgreSQL on a Windows based system, and I was
surprised that the psql tool behaves differently, when it comes to the
functionality of the readline library.

There is no tab-completion for commands or schema/view/table names.
Also, browsing through previous commands within the history is different
from the psql version on Linux systems. Only single lines, not complete
commands show up in the history.

This may be due to some library differences, but wouldn't it be possible
to link some powerful readline and tab-completion libraries also on
Windows systems?

Maybe it's a question for psql developers, should I write on a different
list?

Kind Regards,

Holger

--

Holger Jakobs, Bergisch Gladbach



Re: psql on Windows systems

From
Holger Jakobs
Date:
Am 05.07.24 um 20:24 schrieb Zaid Shabbir:
On which windows platform you are 

Have you face the same behaviour with the windows installer ?

On Fri, 5 Jul 2024 at 11:21 PM, Holger Jakobs <holger@jakobs.com> wrote:
Dear friends,

Recently I had to use PostgreSQL on a Windows based system, and I was
surprised that the psql tool behaves differently, when it comes to the
functionality of the readline library.

There is no tab-completion for commands or schema/view/table names.
Also, browsing through previous commands within the history is different
from the psql version on Linux systems. Only single lines, not complete
commands show up in the history.

This may be due to some library differences, but wouldn't it be possible
to link some powerful readline and tab-completion libraries also on
Windows systems?

Maybe it's a question for psql developers, should I write on a different
list?

Kind Regards,

Holger

--

Holger Jakobs, Bergisch Gladbach




Yes, I used the installer by Enterprise DB. It's an ordinary Windows 2022 server, but this doesn't make any difference.


--

Holger Jakobs, Bergisch Gladbachchat with me on Signal messenger

Re: psql on Windows systems

From
Holger Jakobs
Date:
Am 05.07.24 um 20:23 schrieb Tom Lane:
Holger Jakobs <holger@jakobs.com> writes:
Recently I had to use PostgreSQL on a Windows based system, and I was 
surprised that the psql tool behaves differently, when it comes to the 
functionality of the readline library.
Yeah, readline doesn't exist for Windows last I heard.  At least,
we don't try to build with it there.
			regards, tom lane

"Microsoft offers its Windows Subsystem for Linux (WSL) as an installable add-on for Windows 10 and Windows 11. It's basically a separate packaged version of the Linux kernel that runs as a Windows service, and you can build and install readline-8.2 within that environment." Maybe it works when the machine doing the compiling and packaging has WSL installed. Would be worth trying, imho.

The license of the Gnu readline library shouldn't impose any problem, as other BSD/MIT-licensed software, like Tcl (https://tcl-lang.org) also uses it.

Kind Regards,
Holger

--

Holger Jakobs, Bergisch Gladbach

Re: psql on Windows systems

From
Laurenz Albe
Date:
On Fri, 2024-07-05 at 20:47 +0200, Holger Jakobs wrote:
> > Holger Jakobs <holger@jakobs.com> writes:
> > > Recently I had to use PostgreSQL on a Windows based system, and I was
> > > surprised that the psql tool behaves differently, when it comes to the
> > > functionality of the readline library.
>
> The page https://tiswww.cwru.edu/php/chet/readline/rltop.html says:
>
> "Microsoft offers its Windows Subsystem for Linux (WSL) as an installable add-on
> for Windows 10 and Windows 11. It's basically a separate packaged version of
> the Linux kernel that runs as a Windows service, and you can build and install
> readline-8.2 within that environment." Maybe it works when the machine doing
> the compiling and packaging has WSL installed. Would be worth trying, imho.

Yes, it should be simple to build "psql" with readline in that environment, so
I recommend that you do that.

I guess the Windows binaries don't want to require the users to install
Microsoft's Linux emulation.  After all, if you do that, you might as well
use the ready-made Linux binaries.

Yours,
Laurenz Albe



Re: psql on Windows systems

From
Zaid Shabbir
Date:
I think it's a good idea to provide the readline support in the community Windows installer.

On Sat, Jul 6, 2024 at 10:51 AM Laurenz Albe <laurenz.albe@cybertec.at> wrote:
On Fri, 2024-07-05 at 20:47 +0200, Holger Jakobs wrote:
> > Holger Jakobs <holger@jakobs.com> writes:
> > > Recently I had to use PostgreSQL on a Windows based system, and I was
> > > surprised that the psql tool behaves differently, when it comes to the
> > > functionality of the readline library.
>
> The page https://tiswww.cwru.edu/php/chet/readline/rltop.html says:
>
> "Microsoft offers its Windows Subsystem for Linux (WSL) as an installable add-on
> for Windows 10 and Windows 11. It's basically a separate packaged version of
> the Linux kernel that runs as a Windows service, and you can build and install
> readline-8.2 within that environment." Maybe it works when the machine doing
> the compiling and packaging has WSL installed. Would be worth trying, imho.

Yes, it should be simple to build "psql" with readline in that environment, so
I recommend that you do that.

I guess the Windows binaries don't want to require the users to install
Microsoft's Linux emulation.  After all, if you do that, you might as well
use the ready-made Linux binaries.

Yours,
Laurenz Albe


Re: psql on Windows systems

From
Holger Jakobs
Date:
Am 06.07.24 um 07:51 schrieb Laurenz Albe:
> On Fri, 2024-07-05 at 20:47 +0200, Holger Jakobs wrote:
>>> Holger Jakobs <holger@jakobs.com> writes:
>>>> Recently I had to use PostgreSQL on a Windows based system, and I was
>>>> surprised that the psql tool behaves differently, when it comes to the
>>>> functionality of the readline library.
>> The page https://tiswww.cwru.edu/php/chet/readline/rltop.html says:
>>
>> "Microsoft offers its Windows Subsystem for Linux (WSL) as an installable add-on
>> for Windows 10 and Windows 11. It's basically a separate packaged version of
>> the Linux kernel that runs as a Windows service, and you can build and install
>> readline-8.2 within that environment." Maybe it works when the machine doing
>> the compiling and packaging has WSL installed. Would be worth trying, imho.
> Yes, it should be simple to build "psql" with readline in that environment, so
> I recommend that you do that.
>
> I guess the Windows binaries don't want to require the users to install
> Microsoft's Linux emulation.  After all, if you do that, you might as well
> use the ready-made Linux binaries.
>
> Yours,
> Laurenz Albe
>
I think that it would be possible to statically link any libraries which 
aren't available on a standard Windows installation lacking WSL.

Of course, forcing WSL on all Windows users is a no-go.

Maybe this link helps with that:
https://stackoverflow.com/questions/4737082/statically-linked-correctly-working-readline-library-under-windows

Kind Regards,

Holger

-- 

Holger Jakobs, Bergisch Gladbach