Re: psql \copy hanging

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: arnaud(dot)listes(at)codata(dot)eu, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: psql \copy hanging
Date: 2019-10-04 17:08:19
Message-ID: 8f921914-178e-b520-7f93-dab80ea02555@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2019-10-04 17:22:27 Re: Postgres 12: backend crashes when creating non-deterministic collation
Previous Message Thomas Kellerer 2019-10-04 17:00:36 Re: Postgres 12: backend crashes when creating non-deterministic collation