Re: BUG #15654: COPY command not working for 2gb CSV files

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: sandeep(dot)t(dot)kumar(at)gmail(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #15654: COPY command not working for 2gb CSV files
Date: 2019-02-25 14:42:40
Message-ID: CAKJS1f_qgyV4C_3g66ii2mVS7sjx05-PPXekyEE5iXJbsGHC7w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, 26 Feb 2019 at 00:35, PG Bug reporting form
<noreply(at)postgresql(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2019-02-25 19:09:50 BUG #15655: local machines pushed openvpn dns issue
Previous Message Prakash Ramakrishnan 2019-02-25 11:45:28 Re: BUG #15648: oracle_fdw extension not able to create