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 1iGR4B-0007So-Sp for pgsql-general@arkaria.postgresql.org; Fri, 04 Oct 2019 17:08:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iGR4A-00045r-IY for pgsql-general@arkaria.postgresql.org; Fri, 04 Oct 2019 17:08:30 +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 1iGR49-00045G-0E for pgsql-general@lists.postgresql.org; Fri, 04 Oct 2019 17:08:30 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iGR44-0001Iy-Ul for pgsql-general@postgresql.org; Fri, 04 Oct 2019 17:08:28 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 343E621EFE; Fri, 4 Oct 2019 13:08:22 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 04 Oct 2019 13:08:22 -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=fm1; bh=M 19FdjmFeopRxqOIb95lHLJ1X/qDW93ChqL2dfQjIOg=; b=H5bA2fLCjktvkYJMM IygPLi6wEePl1RFOYP60ktnovhtN246vuDoMFegQt1vgPl3FWw4+PtXYjU8CHBTo 6VfgXpuvdG5osjgKZeSIq4cnuHRmMn0cuCqZszO34+bUgsWyUhGLK+3/ZgaQwuaF GefEyKUBUMHRGdJ//vjGVTHKkEXjAY0JDL+KUGnWZNwu5os0W2jRIMepjatFTBzP 6r2WE6fXhGQdrLaRgGWfaMZ9g5FCofltcZ24dYUo1WSelFc/yGmIv53/JkTeDvRC FD7kdu02T/hLo0+a0barjmXMz2GCYgnybk10hxca5Z1cfaohfXyE1BHbrET15QRW GTEwQ== 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=M19FdjmFeopRxqOIb95lHLJ1X/qDW93ChqL2dfQjI Og=; b=A6f2KStQ8eDTZeEbddX+UXyq7VviWwLpnk/JFKtkRbsRusNkTSm7EZjlb 8xNNreyECMOPIGfzOm1ust7hwroE4xsmhuwsGd5WUF6+6D9bx1iwUGEbnS5ldBhw 0WzYYfrJtMRo8ueBh5K5MKvH5qd/wFBkEQPemwdvc82cIjxeHDKvKZg8RY8ZBA08 3OTRYLB2iVF38/SPnPQXhecqF+GBh1qvLNt36lGYwd85i766KrP9cOl94uqLq8Zc VW2ZvoO69KfXICnEboqIY3WcxfrX7KQE9R03zgv8DNWml+EeSnuOwqGMsx0R824y mQGAnxNn7Ht+i3u37hqbj07awMlVw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrhedugddutdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhffkffgfgggjtgfgsehtke ertddtfeejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecukfhppeejfedrvdefledruddujedrvd efkeenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghk lhgrvhgvrhdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from ranger.suse (c-73-239-117-238.hsd1.wa.comcast.net [73.239.117.238]) by mail.messagingengine.com (Postfix) with ESMTPA id E22D980059; Fri, 4 Oct 2019 13:08:20 -0400 (EDT) Subject: Re: psql \copy hanging To: arnaud.listes@codata.eu, 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> From: Adrian Klaver Message-ID: <8f921914-178e-b520-7f93-dab80ea02555@aklaver.com> Date: Fri, 4 Oct 2019 10:08:19 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <230d9c65-450f-b97c-7ef0-c8e9a85103f6@codata.eu> 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 On 10/4/19 12:19 AM, Arnaud L. wrote: > Le 03/10/2019 à 16:32, Adrian Klaver a écrit : >> I may have missed it before, but where is the Postgres server located? > > On the same local area network. Not on the computer running the script > (so direct COPY TO is not an option). > > >> Given that this seems to be some sort of resource issue and that the >> below contains commands that are not dependent on each other, have you >> thought of splitting myscript.sql into two scripts? If nothing else the >> n(total line)-problem line in one script and the problem line in >> another. That would help nail down whether that line is truly the >> problem or if it is an interaction with running the other 50+ lines. > > 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. > > 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)# select version(); version ---------------------------------------------------------------------------------------------------------------------------- PostgreSQL 11.5 on x86_64-pc-linux-gnu, compiled by gcc (SUSE Linux) 7.4.1 20190424 [gcc-7-branch revision 270538], 64-bit (1 row) ^ production_(postgres)# \copy (select * from cell_per) TO 'cell.txt' COPY 68 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' ^ production_(postgres)# \copy (select * from cell_per) TO STDOUT\g 'cell.txt' ERROR: syntax error at or near "'cell.txt'" LINE 1: COPY ( select * from cell_per ) TO STDOUT 'cell.txt' > > Regards > -- > Arnaud > > > -- Adrian Klaver adrian.klaver@aklaver.com