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 1moIq1-0006IZ-A6 for pgsql-bugs@arkaria.postgresql.org; Sat, 20 Nov 2021 05:22:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1moIq0-0000hs-8X for pgsql-bugs@arkaria.postgresql.org; Sat, 20 Nov 2021 05:22:56 +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 1moIpy-0000hg-Uv for pgsql-bugs@lists.postgresql.org; Sat, 20 Nov 2021 05:22:56 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1moIpu-0007UD-VE for pgsql-bugs@lists.postgresql.org; Sat, 20 Nov 2021 05:22:54 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 31EE05C00BC; Sat, 20 Nov 2021 00:22:48 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sat, 20 Nov 2021 00:22:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=ub6tXb4K1Gnk9FC4pxmv8hfdgHb KNhS/Pbx0AHEtUO8=; b=aqwfRnpaUB/ssz5NyYi8Prr+wJIUMQnGfneUVMWNhxc NZDRMK0gBQ8RXE2eM25olwuv4wAodh0D2N8DX+VGnQtYSp8h6mzcO1jxeIVzSZvz FSW8e6dV7mxLxR1MWU/9uGrqJukMVMdQNZiLGejove0JdV8o/cHz5J/NiatZAR/k zrYqwB4TNeSlA4J21WOysqOqdK68tjrDa8wrMKORpkzhq2Bk8pUWeZXe+FQRd1Nh 126+lDaEXxCppY3Ec1lSVG5LsygQ6hVKgUNf7qtqyOI0kJ7+Zo++Coj91V+0zPPZ dXIBziiCj1wB01yz3BHOWTtTd3zPy61CQWXlHQpIqPQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=ub6tXb 4K1Gnk9FC4pxmv8hfdgHbKNhS/Pbx0AHEtUO8=; b=BWcB94oAMbabTheQIbWHFF L0FXlf3DK2x0vcgaiInJaWYry09k3af87vFRddIc6qi7oQ0UwrjbZ7BgJx7aFglW ChBackY7WP+4teR02NRiU9/BWmC0ZkMEqlqA/k2BJP+/99rYt7QpU37CuuuY5884 LmuIzAk4ydS7jVf1zjuMm+pry1OIk/zAQ0SiXAnuwnjg1rjveJcDrMIjtPHuFBEQ AuRlG4EFcmv3pY7fhfDdb9YpdUcglQjsEilpokiJwFLDxd1YGXuvMjuCcDpokXXp bm9GaUvbRajs8FdC2l2fcZZaJiTCgTgbVCoNz8tiO2Srnilj6XspBMSNmAQDjamw == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrfeelgdejjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdejtddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddu necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepvedtgfekudduueevteefgefgjedu vddtteeuhfelueffueekiefhjefgieegudelnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihii X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 20 Nov 2021 00:22:46 -0500 (EST) Date: Sat, 20 Nov 2021 14:22:43 +0900 From: Michael Paquier To: Juan =?iso-8859-1?Q?Jos=E9_Santamar=EDa?= Flecha Cc: Dmitry Koval , PostgreSQL mailing lists Subject: Re: BUG #17288: PSQL bug with COPY command (Windows) Message-ID: References: <9e4efe29-0ff9-0808-fe32-d1d50e0be4fa@postgrespro.ru> <4c22d38f-efa9-4d83-c551-707f1770e585@postgrespro.ru> <9caa0612-19e5-f860-4b97-908a1c721233@postgrespro.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="A7ZZqGUBD/qVd4q3" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --A7ZZqGUBD/qVd4q3 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 19, 2021 at 12:44:14PM +0100, Juan Jos=E9 Santamar=EDa Flecha w= rote: > GetFinalPathNameByHandleA() is slower when there is redirection, when the= re > is no redirection it's similar or faster than GetFileInformationByHandle(= ), > and that should be the most common case. Yeah, the slight performance impact caused by the redirection does not worry me much, based on the code path of Postgres where this would be called. And that's unlikely going to become a bottleneck anyway as GetFinalPathNameByHandleA() would just be called if we know that we are with stdin, stdout or stderr thanks to the first part of the "if" clause. I like the simplicity behind v4 as it does not interfere with _pgstat64() while dealing with the redirection case, so it should address the concerns from Dmitry anyway (right?). We should really add a comment explaining why this is handled this way though for the case of streams, why the case of the redirection matters, and why we count on a failure of GetFinalPathNameByHandleA(). -- Michael --A7ZZqGUBD/qVd4q3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmGYhiMACgkQnvQgOdby QH0s1BAAkg6vGqkWwUqO2m00OhUvYg0ZzJm1mIQ+RcJYs+bJYqZeV9qWCB0ildOO iRQwnrM6iOWrIGVxQtlPXBarGJfyZgIaHceEy4MpN65FdWouVWCSzNw5L3vaY843 KOId8ZRbyk1OMrDMqUZ/UQV+hQ28LmllUaPI9pgOdJqCm0w4BFdSahGRLlVvlk8o iwrS6s/t4Y22E1CWLfs2XJM8JwYBuu1KTJThexYmyX/dDV/ZB+GRf5cQSk48BD8O pb7e0tHHEe0QSdmbmRmc7OTUqsHp0MXXWRBNtg/Y/zkWCGitQEAyCoDiBfUc4Bew RPRFlHIRMB/sx6uva8N99Vg0SN7fgRfpw7LRceURCH0PSai5irBmki5zHQx4q3Wl sw5XwOovtNL74G14kielvOXRkNMXOoJNGHt7Tb2or+wMykku1lSZeBadkKOJ8eip +Q9PCt95uGHfE96gtXKHYVoU2iU56+u7Ai2gqnQbc8Wv2wMNoqQfA3rXxveRli5/ nxxnlWs2uD6zzrnnAqBL8qD0CI329FUMOLY9RxfHGcziED/YouxrucPtuizpUqFd a3BsHVsWl2NCw1hxDnnPH1JySTG4e0cVDNN/A1uKNyabtFI/z76Z2Qd2gSBmX7yt VhlZg0JSLfl/XrYjkU4zzjaK2yEJ+75olkWqcDv29ZmLchCq7uA= =lbky -----END PGP SIGNATURE----- --A7ZZqGUBD/qVd4q3--