Unix-domain socket support on Windows - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Unix-domain socket support on Windows
Date
Msg-id 54bde68c-d134-4eb8-5bd3-8af33b72a010@2ndquadrant.com
Whole thread Raw
Responses Re: Unix-domain socket support on Windows
Re: Unix-domain socket support on Windows
List pgsql-hackers
It works!

(apparently as of Windows 10 version 1803)

Here are some patches to get a discussion rolling.

Basically, it just works, but you need to define your own struct
sockaddr_un.  (This is what configure currently uses as a proxy for
HAVE_UNIX_SOCKETS, so (a) that needs a bit of tweaking, and (b) that is
the reason why builds haven't blown up already.)

But we'll now need to make things work so that binaries with Unix-domain
socket support work on systems without run-time support.  We already did
that exercise with IPv6 support, so some of the framework is already in
place.

Depending on your Windows environment, there might not be a suitable
/tmp directory, so you'll need to specify a directory explicitly using
postgres -k or similar.  This leads to the question what the default for
DEFAULT_PGSOCKET_DIR should be on Windows.  I think it's probably best,
at least for now, to set it so that by default, neither server nor libpq
use Unix sockets unless explicitly selected.  This can be done easily on
the server side by defining DEFAULT_PGSOCKET_DIR as "".  But in libpq, I
don't think the code would handle that correctly everywhere, so it would
need some more analysis and restructuring possibly.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment

pgsql-hackers by date:

Previous
From: Dmitry Igrishin
Date:
Subject: Re: Small patch to fix build on Windows
Next
From: Tom Lane
Date:
Subject: Re: stress test for parallel workers