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 1mpk6n-0007AL-H6 for pgsql-bugs@arkaria.postgresql.org; Wed, 24 Nov 2021 04:42:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mpk6m-0006pX-4G for pgsql-bugs@arkaria.postgresql.org; Wed, 24 Nov 2021 04:42:12 +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 1mpk6l-0006pO-SX for pgsql-bugs@lists.postgresql.org; Wed, 24 Nov 2021 04:42:11 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mpk6j-0001yc-Jt for pgsql-bugs@lists.postgresql.org; Wed, 24 Nov 2021 04:42:11 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 6CBC95C00CD; Tue, 23 Nov 2021 23:42:08 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 23 Nov 2021 23:42:08 -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=4TQfikgBps6wA7mPRKB6dn+zSmQ +ftmep1+KP4v9iwU=; b=I2qonfhQtnOOoJ8X6DoZuqopIY1hS5p0sruIv+k/Spr u1qpF7poRACknPsBUU2lGQ6w/aX1Ja03tucPsakV9mkU5JykJcdKTC3O6ArJE1r5 hKwOpTBCTLYJ/sSEJvdpTVUJcfsj5E48lGqvdaO9EAZK0IyE23v48lpDQHxRvoha NUrktqycJ7nm/6VLoPCBCKT+KzDb53r9TqXqsydi/qpoaLgPPZ7KpChQm8PS6CXq MX2JPbTphkKpELiNR8SyTDTqeocW55K4AADOCTYIywVwr6tvlqia30VwYCc9zgAk MtAPW0rj1yneI7tLHUk2Pi7USOZSIrpPAaXA1Ezkwaw== 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=4TQfik gBps6wA7mPRKB6dn+zSmQ+ftmep1+KP4v9iwU=; b=AehRo/qw8Eu9yV+1hYzt4O O4K1dur+PsPXADYsqmmWQj3gBpxbxhHUClY7BaH2r8bzfZlbqBLbr1QrDZ/wZL1E k/ks/NUSY7Re1VAjRMLIQnyAQxPhdFOQQp3Pu06c7WlYCx43GbRKzUg9iadjJA2D JY79gcpZYMrH4HzD86zObjUjoSfzxMnTHMN7hyOVfrK2IhMzXdPuN2JvOAXJhYLq 9oR4WNtg45KwXvrbthgswhlMsQUo2pgjXI3raMQiI574+ADDtIBY88cibf2hdoBy DyBG7XRISRyg4kaIktyDYZS1phvPr2RhrqQJ2l/pw5xddi50AHtftSKuV73NZyKg == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrgeejgdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdejtddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepvdegudeuhfdtueeltedtveejheeh ieevueeigeelteegleejleeiueeiheegvefhnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihii X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 23 Nov 2021 23:42:05 -0500 (EST) Date: Wed, 24 Nov 2021 13:42:03 +0900 From: Michael Paquier To: Dmitry Koval Cc: Juan =?iso-8859-1?Q?Jos=E9_Santamar=EDa?= Flecha , PostgreSQL mailing lists Subject: Re: BUG #17288: PSQL bug with COPY command (Windows) Message-ID: References: <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="GZwnlaknznqHFjKZ" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --GZwnlaknznqHFjKZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > 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. R= eturn + * 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 --GZwnlaknznqHFjKZ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmGdwpsACgkQnvQgOdby QH1kCRAAhciRb3ypHvMEchw6op6asVhhmy4IV1nxBxGQUV4VX/91a432yeKvA/tE JtXynAGZa0Kb+jYdwGYDuARNOpVAKxkgvtt7d2+RVmtmMEDme1wtQolml++adXRK JWp6umKPHx/xFBlcYFPH/gjtS4zj6J66gOB63uiZeCqdTO4EupSePOKWoMn83/bT jx7Ft7YnC6TtJ+3SaYc6ybJ7CkWTzQL4t18iqMe6mUe6TbVxrsGPFGJ1QyiYVFhh d6TA7BGZwF+3Vz7DMVgO+2MMj65vRwXod+x+uQ6QkiTJvWfQWCCyNp8x1pClkm0R gKhfSFF2CJ1J02svvF84VsdHPjuoLWqGoC98Mj0FGEGoxjaXI9YnQXBSguUMuOGE 54L+2VFfIl1KXZgXCGXcHKMy++dRwChll36PBr1AFo4bMyODEb8k/WG4Auyf0isP 9EoeoradV2Fi8uAebva/DE+lWQyPNVcxRE5kdT10jI9sfkDiRpaLjtnrPAHb6dpt DddHaORmJGvyhGy1C8P+n/Mf7X7kOWUCrLRc6JbYd/jpBvZhyHkx2BD04XknzpJE bDVZUMo5nWRRwSRpiG/1rU3I6qr5/0LwNIk7EZvf8k0XrNDgeK6l/3imBi1rdEHq 7zZJsUhI1UmqTn1BqwHFL3ssWVWYrfWNHwOxKUVvcq7d11TFhX4= =JZt1 -----END PGP SIGNATURE----- --GZwnlaknznqHFjKZ--