Re: BUG #15654: COPY command not working for 2gb CSV files - Mailing list pgsql-bugs

From David Rowley
Subject Re: BUG #15654: COPY command not working for 2gb CSV files
Date
Msg-id CAKJS1f_qgyV4C_3g66ii2mVS7sjx05-PPXekyEE5iXJbsGHC7w@mail.gmail.com
Whole thread Raw
In response to BUG #15654: COPY command not working for 2gb CSV files  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #15654: COPY command not working for 2gb CSV files
List pgsql-bugs
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


pgsql-bugs by date:

Previous
From: Prakash Ramakrishnan
Date:
Subject: Re: BUG #15648: oracle_fdw extension not able to create
Next
From: PG Bug reporting form
Date:
Subject: BUG #15655: local machines pushed openvpn dns issue