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 1iG1rP-0004Ys-9r for pgsql-general@arkaria.postgresql.org; Thu, 03 Oct 2019 14:13:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iG1rN-0001k0-RP for pgsql-general@arkaria.postgresql.org; Thu, 03 Oct 2019 14:13:37 +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 1iG1rN-0001jr-HI for pgsql-general@lists.postgresql.org; Thu, 03 Oct 2019 14:13:37 +0000 Received: from serveurmail01.codata.be ([82.146.123.190]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iG1rL-00063t-8A for pgsql-general@postgresql.org; Thu, 03 Oct 2019 14:13:37 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by serveurmail01.codata.be (Postfix) with ESMTP id 2976A900C8; Thu, 3 Oct 2019 16:13:34 +0200 (CEST) X-Virus-Scanned: amavisd-new at serveurmail01.codata.be Received: from serveurmail01.codata.be ([127.0.0.1]) by localhost (serveurmail01.codata.be [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id x7InjqYUO4kG; Thu, 3 Oct 2019 16:13:33 +0200 (CEST) Received: from [10.0.0.100] (38-179-112-217.fix.adsl.belcenter.be [217.112.179.38]) by serveurmail01.codata.be (Postfix) with ESMTPSA id 07F49900B8; Thu, 3 Oct 2019 16:13:32 +0200 (CEST) Reply-To: arnaud.listes@codata.eu Subject: Re: psql \copy hanging To: Adrian Klaver , pgsql-general References: <9e9164df-e7b7-bcd3-538a-7714907f7df4@aklaver.com> From: "Arnaud L." Message-ID: <171491de-b8e1-7f0d-0724-4d06a7902cc0@codata.eu> Date: Thu, 3 Oct 2019 16:13:31 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <9e9164df-e7b7-bcd3-538a-7714907f7df4@aklaver.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Le 03/10/2019 à 15:54, Adrian Klaver a écrit : > On 10/2/19 11:51 PM, Arnaud L. wrote: >> Well, this problem is still bugging me, and this time I've tried with a >> local file. Unfortunately, it did not help. >> To further rule out filesystem problems, I first took care to delete the >> target files before copying to it, but it did not help either. >> >> So now I'm quite confident that the problem is either psql or even >> postgresql itself. >> >> Does anyone know of anything I could try to try to fix or debug this ? > > Going back to the original thread I noticed it was not specified what > program was being used to run the script in the overnight session. > > So what is being used to run the script overnight? Yes, sorry for having lost the original thread, my mailbox has a quite stupid automatic purge schedule... The script is run in a windows batch file. Basically, export.bat contains : SET PGUSER=myuser SET PGPASSWORD=mypwd SET PGCLIENTENCODING=UTF8 SET MYPGSERVER=myserverurl SET MYPGDB=mydatabase psql -h %MYPGSERVER% -a -f myscript.sql %MYPGDB% And myscript.sql contains : \copy (SELECT * FROM view1) TO '\\server\share\view1.txt' \copy (SELECT * FROM view2) TO '\\server\share\view2.txt' ... etc with ~60 views Today, I've update the problematic \copy line to be : COPY (SELECT * FROM view) TO STDOUT \g '\\server\share\view.txt' I'll keep you informed (even though a successfull run is not a guarantee of success, because the original script did sometimes work). Regards -- Arnaud