Upon review, I don't think these patches are very good at all.
#defining errno as WSAGetLastError() is a fairly blunt instrument,
and it breaks all the places that do actually need to use errno,
such as PQoidValue, lo_import, lo_export. I'm also concerned that
PQrequestCancel may need to save/restore both errno and
WSAGetLastError() in order to be safe for use in a signal handler.
Is errno a plain variable on WIN32, or is it a macro? If the former,
we could hack around this problem by doing
#if WIN32#undef errno#endif
...
#if WIN32#define errno WSAGetLastError()#endif
around the routines that need to access the real errno. While ugly,
this probably beats the alternative of ifdef'ing all the places that
do need to access the WSA error code.
regards, tom lane