Re: pg_dump/pg_restore: Fix stdin/stdout handling of custom format on Win32

From: Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>
To: Daniel Watzinger <daniel(dot)watzinger(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Daniel Gustafsson <daniel(at)yesql(dot)se>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump/pg_restore: Fix stdin/stdout handling of custom format on Win32
Date: 2023-03-14 12:47:09
Message-ID: CAC+AXB110=KAhu2XMX45oPX6G9ePEGwUGtCC2c4AMXQcEuwAPw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Please, don't top post.

On Tue, Mar 14, 2023 at 12:30 PM Daniel Watzinger <
daniel(dot)watzinger(at)gmail(dot)com> wrote:

> I'm sorry I couldn't contribute to the discussion in time. The fix of the
> fstat() Win32 port looks good to me. I agree that there's a need for
> multiple fseek() ports to address the shortcomings of the MSVC
> functionality.
>
> The documentation event states that "on devices incapable of seeking, the
> return value is undefined". A simple wrapper using GetFileType() or the new
> fstat(), to filter non-seekable devices before delegation, will probably
> suffice.
>
>
> https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/fseek-fseeki64?view=msvc-170
>

I have just posted a patch to enforce the detection of unseekable streams
in the fseek() calls [1], please feel free to review it.

[1]
https://www.postgresql.org/message-id/CAC%2BAXB26a4EmxM2suXxPpJaGrqAdxracd7hskLg-zxtPB50h7A%40mail.gmail.com

Regards,

Juan José Santamaría Flecha

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Jones 2023-03-14 12:58:28 Re: [PATCH] Add pretty-printed XML output option
Previous Message Juan José Santamaría Flecha 2023-03-14 12:26:27 Fix fseek() detection of unseekable files on WIN32