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: Thu, 3 Oct 2019 07:32:17 -0700
Message-ID: <291938b2-5816-5858-065f-e85387def0eb@aklaver.com> (raw)
In-Reply-To: <171491de-b8e1-7f0d-0724-4d06a7902cc0@codata.eu>
References: <bb6d847c-e9c0-4b6d-4299-0b879042899a@codata.eu>
<9e9164df-e7b7-bcd3-538a-7714907f7df4@aklaver.com>
<171491de-b8e1-7f0d-0724-4d06a7902cc0@codata.eu>
On 10/3/19 7:13 AM, Arnaud L. wrote:
> 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%
I may have missed it before, but where is the Postgres server located?
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.
>
> 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
>
--
Adrian Klaver
adrian.klaver@aklaver.com
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: <291938b2-5816-5858-065f-e85387def0eb@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>
* 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