Re: BUG #17288: PSQL bug with COPY command (Windows)
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Dmitry Koval <d.koval@postgrespro.ru>
Cc: Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2021-11-24T04:42:03Z
Lists: pgsql-bugs
On Mon, Nov 22, 2021 at 02:07:09PM +0300, Dmitry Koval wrote:
> > It reads a little too much like pseudocode for my liking. Please
> > consider the attached version.
>
> This is a good comment, I like it.
/*
+ * Check if the fileno is a data stream. If so, unless it has been
+ * redirected to a file, getting information by handle will fail. Return
+ * the appropriate stat information instead.
+ */
I would perhaps add an extra note that we emulate the result in the
best way we can. Anyway, what you have here looks basically enough.
Another thing that has been itching me on this thread is that we have
not been able to detect this problem even if we have tests in
copyselect.sql that cover those paths. Is that because running
vcregress.pl implies a redirection of stdout so we would never see,
except from a terminal?
--
Michael
Commits
-
Fix compatibility thinko for fstat() on standard streams in win32stat.c
- 5550a9c38519 14.2 landed
- 58651d8dd6a5 15.0 landed
-
Fix fstat() emulation on Windows with standard streams
- d2198b4593cc 14.2 landed
- 10260c794b21 15.0 landed