pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Arnaud L. <arnaud.listes@codata.eu>
To: pgsql-general@postgresql.org
Subject: psql \copy hanging
Date: Thu, 22 Aug 2019 10:47:22 +0200
Message-ID: <d5df5507-7491-5877-5412-c9325d0ec49c@codata.eu> (raw)

Hi list

On Windows, I have an unattended script that exports data overnight by 
issuing psql commands like :
psql -f mycommands.sql
whith mycommands.sql containing a bunch of \copy lines like :
\copy (SELECT * FROM someview) TO 
'\\windowsserver\windowsshare\somefile.csv'

When I run this script by hand, everything is fine but when it runs 
overnight it hangs and allways on the same line.
There is no lock in the database, and the connection is marked as active 
in the backend and running the statement "COPY (SELECT * FROM myview) TO 
STDOUT".
So where can things be hanging ?
My first guess (appart from db lock) was that the target file was locked 
by the filesystem. But wouldn't psql know about it and fail with an error ?

Thanks for your help !

--
Arnaud





view thread (40+ messages)  latest in thread

Message-ID: <d5df5507-7491-5877-5412-c9325d0ec49c@codata.eu>
Permalink:  ../d5df5507-7491-5877-5412-c9325d0ec49c@codata.eu/
Also on:    postgresql.org/message-id/d5df5507-7491-5877-5412-c9325d0ec49c@codata.eu

 · 

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: arnaud.listes@codata.eu
  Subject: Re: psql \copy hanging
  In-Reply-To: <d5df5507-7491-5877-5412-c9325d0ec49c@codata.eu>
  References: <d5df5507-7491-5877-5412-c9325d0ec49c@codata.eu>

* 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