Re: pgsql: Allow concurrent-safe open() and fopen() in frontend code for Wi

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Allow concurrent-safe open() and fopen() in frontend code for Wi
Date: 2018-09-18 16:04:58
Message-ID: c68010480459c79f24a015096ae43b6f0bcd9854.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Tom Lane wrote:
> Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> writes:
> > Would it be an option to have pgwin32_open default to text mode in
> > frontend code and to binary mode in backend code?
>
> Well, the question is why Michael's latest proposed patch doesn't
> accomplish that.

I was thinking of something trivial like this:

--- a/src/port/open.c
+++ b/src/port/open.c
@@ -71,6 +71,12 @@ pgwin32_open(const char *fileName, int fileFlags,...)
_O_SHORT_LIVED | O_DSYNC | O_DIRECT |
(O_CREAT | O_TRUNC | O_EXCL) | (O_TEXT | O_BINARY))) == fileFlags);

+#ifdef FRONTEND
+ /* default to text mode in frontend code */
+ if (fileFlags & O_BINARY == 0)
+ fileFlags |= O_TEXT;
+#endif
+
sa.nLength = sizeof(sa);
sa.bInheritHandle = TRUE;
sa.lpSecurityDescriptor = NULL;

That wouldn't influence pipes, which was what Michael said was a
problem for pg_dump.

I currently have no Windows system close, so I cannot test...

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2018-09-18 17:02:49 pgsql: Fix some probably-minor oversights in readfuncs.c.
Previous Message Tom Lane 2018-09-18 15:38:57 Re: pgsql: Allow concurrent-safe open() and fopen() in frontend code for Wi

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2018-09-18 16:09:00 Re: Is it really difficult for postgres_fdw to implement READ COMMITTED isolation?
Previous Message Michael Banck 2018-09-18 15:53:13 Re: Progress reporting for pg_verify_checksums