On Tue, 26 Feb 2019 at 00:35, PG Bug reporting form
<noreply@postgresql.org> wrote:
> Command I am using
> -----------------------------
> Copy table From '<Filename>.csv' DELIMITER '~' null as 'null' encoding
> 'windows-1251' CSV; select 1;
>
> Error I am getting
> ------------------------
> ERROR: could not stat file "<Filename>.csv": Unknown error
> SQL state: XX000
I can recreate that here. The error comes from the call to fstat() in
BeginCopyFrom().
Going by the Microsoft documentation fstat() only has a file length
type of 32bits.
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fstat-fstat32-fstat64-fstati64-fstat32i64-fstat64i32?view=vs-2017
Seems to work if I change the fstat() call to _fstati64() and change
the type of st to struct _stat64. Perhaps we need to wrap some macros
around these in port and have windows use the 64-bit versions.
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services