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

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: pgsql: Allow concurrent-safe open() and fopen() in frontendcode for Wi
Дата
Msg-id c68010480459c79f24a015096ae43b6f0bcd9854.camel@cybertec.at
обсуждение исходный текст
Ответ на Re: pgsql: Allow concurrent-safe open() and fopen() in frontend code for Wi  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: pgsql: Allow concurrent-safe open() and fopen() in frontend codefor Wi  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-hackers
Tom Lane wrote:
> Laurenz Albe <laurenz.albe@cybertec.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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Banck
Дата:
Сообщение: Re: Progress reporting for pg_verify_checksums
Следующее
От: Ashutosh Bapat
Дата:
Сообщение: Re: Is it really difficult for postgres_fdw to implement READCOMMITTED isolation?