Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i0nda-0007DL-E5 for pgsql-general@arkaria.postgresql.org; Thu, 22 Aug 2019 14:00:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i0ndZ-0001G7-4l for pgsql-general@arkaria.postgresql.org; Thu, 22 Aug 2019 14:00:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i0ndX-00012A-6d for pgsql-general@lists.postgresql.org; Thu, 22 Aug 2019 14:00:24 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i0ndT-0001sw-F1 for pgsql-general@postgresql.org; Thu, 22 Aug 2019 14:00:22 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id BAFA2220A5; Thu, 22 Aug 2019 10:00:17 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 22 Aug 2019 10:00:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=o feR/rFIqg/Vla8BLtx1m1luscByi66NTCBP3u0Uo3E=; b=tnen/elAx6De7SmBa LSBTAtAGC9OfuhIB4ghXiuQEhxmwcjY4jNqR1G6iQrVtVGnbwS9Qtmh2siBDNEAB 3EmeMVRrRRFEBciNPMpR7kY18gXdvdT44HGmRQ/sId9yhXKc1w1qa5YbDPdkwurA 7pTOEQROh3BXBRsYHlfC7mrx+Nt/GBkpJZiQbKgHrL0hkFyNZgWnadxCHHJR1tqo iXbIaOx9lRpMdGJ87p4f2083KUFr1APHiwi1T0slpxz0NycD8M3hDg0PWfxY9BOT LfZRM5etMyc3bMh7VXhhUD5JZyGuLGA49sywV9f+uEyZpV0p7DPR+gQu6GaPQbZz C+CKA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding: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=fm3; bh=ofeR/rFIqg/Vla8BLtx1m1luscByi66NTCBP3u0Uo 3E=; b=O8UBywtXc0wioIMmwUVdC/btHI3OHqIkgU/WhlsNd3fgoL6jgAz7Wc+ym bwOxciEOlebYwJkK9F+XUh8oIbzIZcUWPHK86z+0nHhGD2gF5yxEbzjsHCe4z4OZ XJooKZLO1aDaq8vNWqhN1aKFQVG2Qk1kgIiQFX8JOmNKzZPHM7cQ2UFLyqqzNiM7 kuHYNfciDNo5iLWFq8juUzNHqsWc406Rwx7ecHDM5BqzorRCUUDgPCq4PliBS/l9 BgO1LzjW5H+o8OKHarMY5I26mSoqXwRKh/UqJnxWv95j7bEzTS3zJ1tkIPgXIJ80 3GD3+ouo4bIcnhK0s+3rDJOTvdusw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudegiedgvdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhffkffgfgggjtgfgsehtje ertddtfeejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecukfhppeejuddrvdduvddrudehtddrvd dtvdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghk lhgrvhgvrhdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id 4E47ED6005A; Thu, 22 Aug 2019 10:00:16 -0400 (EDT) Subject: Re: psql \copy hanging To: arnaud.listes@codata.eu, pgsql-general@postgresql.org References: From: Adrian Klaver Message-ID: Date: Thu, 22 Aug 2019 07:00:14 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 8/22/19 1:47 AM, Arnaud L. wrote: > Hi list > > On Windows, I have an unattended script that exports data overnight by > issuing psql commands like : > psql -f mycommands.sql > whith mycommands.sql containing a bunch of \copy lines like : > \copy (SELECT * FROM someview) TO > '\\windowsserver\windowsshare\somefile.csv' > > When I run this script by hand, everything is fine but when it runs > overnight it hangs and allways on the same line. > There is no lock in the database, and the connection is marked as active > in the backend and running the statement "COPY (SELECT * FROM myview) TO > STDOUT". > So where can things be hanging ? The first thing I think of when seeing this sort of behavior on Windows is anti-virus software. Doing you have any running on the machine? You say it always hangs on the same line. Is that line doing something different from the others? Say writing to a different location. > My first guess (appart from db lock) was that the target file was locked > by the filesystem. But wouldn't psql know about it and fail with an error ? > > Thanks for your help ! > > -- > Arnaud > > > -- Adrian Klaver adrian.klaver@aklaver.com