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 1iHNeh-0006X1-Hs for pgsql-general@arkaria.postgresql.org; Mon, 07 Oct 2019 07:42:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iHNeg-0005I2-DQ for pgsql-general@arkaria.postgresql.org; Mon, 07 Oct 2019 07:42:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iHNeg-0005Hl-0X for pgsql-general@lists.postgresql.org; Mon, 07 Oct 2019 07:42:06 +0000 Received: from serveurmail01.codata.be ([82.146.123.190]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1iHNed-0001cp-3m for pgsql-general@postgresql.org; Mon, 07 Oct 2019 07:42:04 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by serveurmail01.codata.be (Postfix) with ESMTP id BD657900C9; Mon, 7 Oct 2019 09:41:59 +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 T673LKcE9Mg8; Mon, 7 Oct 2019 09:41:58 +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 A336C900B8; Mon, 7 Oct 2019 09:41:58 +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> <171491de-b8e1-7f0d-0724-4d06a7902cc0@codata.eu> <291938b2-5816-5858-065f-e85387def0eb@aklaver.com> <230d9c65-450f-b97c-7ef0-c8e9a85103f6@codata.eu> <8f921914-178e-b520-7f93-dab80ea02555@aklaver.com> From: "Arnaud L." Message-ID: Date: Mon, 7 Oct 2019 09:41:57 +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: <8f921914-178e-b520-7f93-dab80ea02555@aklaver.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Le 04/10/2019 à 19:08, Adrian Klaver a écrit : > On 10/4/19 12:19 AM, Arnaud L. wrote: >> OK I can do that. I thought I nailed it down to this line because it >> started failing when this line was ~5th in the script, and it kept >> failing on that very same line after I moved it at the very end of the >> script (that's where it is now). > > Which tends to point to it as the problem. The question is whether it > exhibits that behavior on its own or only when in combination with the > other commands. Yes. It ran fine this last night. I had moved the line back to its original place, so now everything is exactly like it was before it started showing this behaviour. So, still apparently random... >> As a side note, COPY (...) TO STDOUT \g 'somefile' does not work in a >> script file (i.e. it does not work if the command is passed in a file >> via the -f argument). >> The command runs fine, no error is raised either by the client or the >> server, but no file is written. > > Yeah not sure how that is supposed to work: > [...] > production_(postgres)# \copy (select * from cell_per) TO STDOUT \g > 'cell.txt' > ERROR: syntax error at or near "\" > LINE 1: COPY ( select * from cell_per ) TO STDOUT \g 'cell.txt' This works with real SQL commands, so it should be "COPY" here, not "\copy". Regards -- Arnaud