RE: invalid data in file backup_label problem on windows

From: "wangsh(dot)fnst(at)fujitsu(dot)com" <wangsh(dot)fnst(at)fujitsu(dot)com>
To: David Steele <david(at)pgmasters(dot)net>, Magnus Hagander <magnus(at)hagander(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: invalid data in file backup_label problem on windows
Date: 2021-03-28 12:53:09
Message-ID: OSBPR01MB4214A498D0FF4DD4D55B652DF27F9@OSBPR01MB4214.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

David Steele <david(at)pgmasters(dot)net> wrote:
>On 3/26/21 1:20 PM, Magnus Hagander wrote:
>> On Fri, Mar 26, 2021 at 5:52 PM Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>>> On 3/26/21 10:19 AM, David Steele wrote:
>>>>
>>>>> No, the problem is you are using copy/paste and in doing so you are
>>>>> *changing'* the value that is being returned. You'll either need to
>>>>> update your copy/paste procedure to not mess with the newlines, or to
>>>>> use a better way to get the data out.
>>>>>
>>>>> If we need to clarify that in the documentation, I'm fine with that.
>>>>> Maybe add an extra sentence to the part about not modifying the output
>>>>> to mention that this includes changing newslines and also encoding
>>>>> (which would also break it, if you managed to find a non-ascii
>>>>> compatible encoding). Maybe even something along the line of "the
>>>>> contents have to be written in binary mode"?
>>>>
>>>> Perhaps something like the attached?
>>>
>>> That seems a bit opaque. Let's tell them exactly what they need to avoid.
>>
>> Yeah, it seems a bit imprecise. Maybe something like "which includes
>> things like opening the file in binary mode"? (I want the "includes"
>> part because it also means other things, this is not the only thing).
>
>OK, how about the attached?

I think this is good for me to avoid this problem.
And next time I will use libpq and fopen(xxx, "wb") to create this file.
Thanks

Best regards
Shenhao Wang

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2021-03-28 13:07:19 Re: [Proposal] Global temporary tables
Previous Message Joel Jacobson 2021-03-28 12:44:51 Re: pl/pgsql feature request: shorthand for argument and local variable references