pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Verite <daniel@manitou-mail.org>
To: Michael Paquier <michael@paquier.xyz>
Cc: Alistair Johnson <alistair.e.w.j@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: Unable to copy large (>2GB) files using PostgreSQL 11 (Windows)
Date: Sat, 03 Nov 2018 12:11:53 +0100
Message-ID: <df939c6f-2866-48b8-b3fe-5cbb54576a53@manitou-mail.org> (raw)
In-Reply-To: <20181102233512.GD1899@paquier.xyz>

	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




view thread (4+ messages)  latest in thread

Message-ID: <df939c6f-2866-48b8-b3fe-5cbb54576a53@manitou-mail.org>
Permalink:  ../df939c6f-2866-48b8-b3fe-5cbb54576a53@manitou-mail.org/
Also on:    postgresql.org/message-id/df939c6f-2866-48b8-b3fe-5cbb54576a53@manitou-mail.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: daniel@manitou-mail.org, michael@paquier.xyz, alistair.e.w.j@gmail.com
  Subject: Re: Unable to copy large (>2GB) files using PostgreSQL 11 (Windows)
  In-Reply-To: <df939c6f-2866-48b8-b3fe-5cbb54576a53@manitou-mail.org>
  References: <20181102233512.GD1899@paquier.xyz> <df939c6f-2866-48b8-b3fe-5cbb54576a53@manitou-mail.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox