Re: BUG #17288: PSQL bug with COPY command (Windows)

From: Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>
To: Dmitry Koval <d(dot)koval(at)postgrespro(dot)ru>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #17288: PSQL bug with COPY command (Windows)
Date: 2021-11-19 11:44:14
Message-ID: CAC+AXB1FTZueNdvT1F4fpr4z9gxpcKkgWa-Awor9XC9PAKLVSA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Nov 19, 2021 at 11:45 AM Dmitry Koval <d(dot)koval(at)postgrespro(dot)ru>
wrote:

> >We can check for redirection without calling
> >GetFileInformationByHandle(), please consider the attached patch.
>
> There are doubts:
>
> 1) we always use system function (GetFinalPathNameByHandleA or
> GetFileInformationByHandle); sometimes we use these two calls
> GetFinalPathNameByHandleA + GetFileInformationByHandle
> together (in freopen() case);
>
> 2) function GetFinalPathNameByHandleA is slower than
> GetFileInformationByHandle (2-4 times).
> Might be exist a cheaper way than GetFinalPathNameByHandleA?
>
> I don't understand why this way better than using one call
> GetFileInformationByHandle...
>
> Personally, I think it is more readable, although a comment should explain
what we are checking.

GetFinalPathNameByHandleA() is slower when there is redirection, when there
is no redirection it's similar or faster than GetFileInformationByHandle(),
and that should be the most common case.

Regards,

Juan José Santamaría Flecha

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Dmitry Koval 2021-11-19 12:27:34 Re: BUG #17288: PSQL bug with COPY command (Windows)
Previous Message Dmitry Koval 2021-11-19 10:45:10 Re: BUG #17288: PSQL bug with COPY command (Windows)