Re: BUG #17288: PSQL bug with COPY command (Windows) - Mailing list pgsql-bugs

From Juan José Santamaría Flecha
Subject Re: BUG #17288: PSQL bug with COPY command (Windows)
Date
Msg-id CAC+AXB1C1C_z3XQR=ZxiG+V0U9RDJFtJJamvYMoq+d4RoVRh4A@mail.gmail.com
Whole thread Raw
In response to Re: BUG #17288: PSQL bug with COPY command (Windows)  (Dmitry Koval <d.koval@postgrespro.ru>)
Responses Re: BUG #17288: PSQL bug with COPY command (Windows)  (Dmitry Koval <d.koval@postgrespro.ru>)
List pgsql-bugs

On Fri, Nov 19, 2021 at 9:47 AM Dmitry Koval <d.koval@postgrespro.ru> wrote:
 >I still think that we should not call GetFileInformationByHandle()
 >when it comes to an argument that we know will fail, ...

Our program calls function freopen() (this function is used in file
src\backend\utils\error\elog.c). So we don't know exactly that
GetFileInformationByHandle() will fails for stdin/stdout/stderr.

Ior illustration, I attached small example (test.c) for this case:
1) GetFileInformationByHandle() for "stdout" works without error;
2) file "1.txt" after running test contains:

Sample string
attributes = 0x2020, file size = 15

We can check for redirection without calling GetFileInformationByHandle(), please consider the attached patch.

Regards,

Juan José Santamaría Flecha
Attachment

pgsql-bugs by date:

Previous
From: Thomas Munro
Date:
Subject: Re: conchuela timeouts since 2021-10-09 system upgrade
Next
From: PG Bug reporting form
Date:
Subject: BUG #17292: view definition containing multiple joins on partitioned table returns invalid explain plan