Re: Replace open mode with PG_BINARY_R/W/A macros

From: Japin Li <japinli(at)hotmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Replace open mode with PG_BINARY_R/W/A macros
Date: 2022-04-19 07:56:25
Message-ID: MEYP282MB166915AEBF09137805448FB9B6F29@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Tue, 19 Apr 2022 at 14:20, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Japin Li <japinli(at)hotmail(dot)com> writes:
>> On Mon, 18 Apr 2022 at 22:41, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> A lot of these changes look wrong to me: they are substituting "rb" for
>>> "r", etc, in places that mean to read text files. You have to think
>>> about the Windows semantics.
>
>> I do this substituting, since the comment says it can be used for opening
>> text files. Maybe I misunderstand the comment.
>
> I think the comment's at best misleading. See e.g. 66f8687a8.
> It might be okay to use "rb" to read a text file when there
> is actually \r-stripping logic present, but you need to check
> that. Using "wb" to write a text file is flat wrong.
>

Thanks for the detail explanation. Should we remove the misleading comment?

--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2022-04-19 07:56:45 Re: [HACKERS] WIP aPatch: Pgbench Serialization and deadlock errors
Previous Message Japin Li 2022-04-19 07:53:36 Re: Replace open mode with PG_BINARY_R/W/A macros