Re: Unable to copy large (>2GB) files using PostgreSQL 11 (Windows) - Mailing list pgsql-bugs

From Daniel Verite
Subject Re: Unable to copy large (>2GB) files using PostgreSQL 11 (Windows)
Date
Msg-id df939c6f-2866-48b8-b3fe-5cbb54576a53@manitou-mail.org
Whole thread Raw
In response to Re: Unable to copy large (>2GB) files using PostgreSQL 11 (Windows)  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Unable to copy large (>2GB) files using PostgreSQL 11 (Windows)
List pgsql-bugs
    Michael Paquier wrote:

> Windows portability problems with stat() makes this problem way harder
> than it looks at first glance, because it also uses a "stat" structure
> which is not able to store the size of files larger than 2GB

FWIW I don't reproduce the problem with a self-compiled PostgreSQL 11.0
with the MSYS2/mingw64 toolchain on a Windows 10 64-bit desktop.

But I do get the error when using PG 11.0 packaged by
EDB and trying the same test on the same machine
(that is, \copy table from file with a file a bit over 2GB).

The error seems to be emited at the point of this fstat() call in
psql/copy.c:

    /* make sure the specified file is not a directory */
    if ((result = fstat(fileno(copystream), &st)) < 0)
        psql_error("could not stat file \"%s\": %s\n",
                   options->file,

Note that it's fstat() rather than stat().
A quick git grep -w seems to show that fstat() doesn't go through
the same kind of aliasing that can make stat() a macro actually
calling pgwin32_safestat().


Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite


pgsql-bugs by date:

Previous
From: Thomas Munro
Date:
Subject: Re: BUG #15460: Error while creating index or constraint
Next
From: Tom Lane
Date:
Subject: Re: BUG #15476: Problem on show_trgm with 4 byte UTF-8 characters