Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mo1OP-0000CX-Ac for pgsql-bugs@arkaria.postgresql.org; Fri, 19 Nov 2021 10:45:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mo1ON-00080V-Af for pgsql-bugs@arkaria.postgresql.org; Fri, 19 Nov 2021 10:45:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mo1OM-00080M-Tg for pgsql-bugs@lists.postgresql.org; Fri, 19 Nov 2021 10:45:15 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mo1OK-00060C-9t for pgsql-bugs@lists.postgresql.org; Fri, 19 Nov 2021 10:45:14 +0000 Received: from [192.168.28.32] (cyclops.postgrespro.ru [93.174.131.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 8551221C1FFA; Fri, 19 Nov 2021 13:45:10 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1637318710; bh=44RoGjmSE2cgx8I4E+gOflgOhlWF0Y0FfZVkgS//mVo=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=B1fTblzxKJ/ftph+PekSE2RpdfnR2dMQNQnvpOl5SBadU/WGLzY5aeFEJWxOlAzIM grise99mQos/EOModxW62V9PrB5cJEnibSVG+nJrRkbcf4uE2h+5EAu5JQE/5krUAG Sn78UI+mdmMklwFDfNbgBtoFAzA4OjHjl3BEZw2I= Message-ID: <9caa0612-19e5-f860-4b97-908a1c721233@postgrespro.ru> Date: Fri, 19 Nov 2021 13:45:10 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: BUG #17288: PSQL bug with COPY command (Windows) Content-Language: ru To: =?UTF-8?Q?Juan_Jos=c3=a9_Santamar=c3=ada_Flecha?= Cc: Michael Paquier , PostgreSQL mailing lists References: <17288-6b58a91025a8a8a3@postgresql.org> <9e4efe29-0ff9-0808-fe32-d1d50e0be4fa@postgrespro.ru> <4c22d38f-efa9-4d83-c551-707f1770e585@postgrespro.ru> From: Dmitry Koval In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk >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... With best regards, Dmitry Koval.