Re: BackgroundPsql swallowing errors on windows - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: BackgroundPsql swallowing errors on windows
Date
Msg-id 762648ad-99b5-4871-beaa-ca275e46ef6e@dunslane.net
Whole thread Raw
In response to Re: BackgroundPsql swallowing errors on windows  (Andres Freund <andres@anarazel.de>)
Responses Re: BackgroundPsql swallowing errors on windows
List pgsql-hackers
On 2025-02-14 Fr 11:54 AM, Andres Freund wrote:
> Hi,
>
> On 2025-02-14 08:14:45 -0500, Andrew Dunstan wrote:
>> It's been discussed before, but I'd really really like to get rid of
>> BackgroundPsql. It's ugly, non-intuitive and fragile.
> I agree, unfortunately we're stuck with this until we have a better
> alternative in tree :(
>
>
>> Last year I did some work on this. I was going to present it at Athens but
>> illness prevented me, and then other life events managed to get in my way.
>> But the basic work is around. See
<https://github.com/adunstan/test-pq/commit/98518e4929e80fb96f210bbc5aab9fdcea058512>
>> This introduces a libpq session object (PostgreSQL::Test::Session) which can
>> be backed either by FFI or a small XS wrapper - the commit has recipes for
>> both. Missing is a meson.build file for the XS wrapper. There are
>> significant performance gains to be had too (poll_query_until is much nicer,
>> for example, as are most uses of safe_psql). If there is  interest I will
>> bring the work up to date, and maybe we can introduce this early in the v19
>> cycle. It would significantly reduce our dependency on IPC::Run, especially
>> the pump() stuff.
> I definitely am interested.


Here we are almost exactly a year later. I returned to this work quite 
recently, and reached a milestone, namely the removal of all calls to 
BackgroundPsql, with all the TAP tests passing. The XS module still has 
some problems, and I think I'm inclined not to pursue it, and just rely 
on the FFI mapping.

The current state of this is attached. People who are interested can hit 
me up for info in Vancouver if not before. I'll work on turning this 
into a set of commitable patches.


cheers


andrew



--
Andrew Dunstan
EDB: https://www.enterprisedb.com

Attachment

pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: pg_upgrade: transfer pg_largeobject_metadata's files when possible
Next
From: Thomas Munro
Date:
Subject: Re: Small improvements to substring()