pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: arnaud.listes@codata.eu
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: psql \copy hanging
Date: Fri, 4 Oct 2019 10:08:19 -0700
Message-ID: <8f921914-178e-b520-7f93-dab80ea02555@aklaver.com> (raw)
In-Reply-To: <230d9c65-450f-b97c-7ef0-c8e9a85103f6@codata.eu>
References: <bb6d847c-e9c0-4b6d-4299-0b879042899a@codata.eu>
	<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>

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 <file> 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





view thread (40+ messages)  latest in thread

Message-ID: <8f921914-178e-b520-7f93-dab80ea02555@aklaver.com>
Permalink:  ../8f921914-178e-b520-7f93-dab80ea02555@aklaver.com/
Also on:    postgresql.org/message-id/8f921914-178e-b520-7f93-dab80ea02555@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, arnaud.listes@codata.eu
  Subject: Re: psql \copy hanging
  In-Reply-To: <8f921914-178e-b520-7f93-dab80ea02555@aklaver.com>
  References: <bb6d847c-e9c0-4b6d-4299-0b879042899a@codata.eu> <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>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox