pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Steve Clark <steve.clark@netwolves.com>
To: pgsql <pgsql-general@postgresql.org>
Subject: Re: psql \copy
Date: Fri, 24 Apr 2020 08:59:33 -0700
Message-ID: <8ae0540e-7068-f296-eddf-3355f8ee8f29@aklaver.com> (raw)
In-Reply-To: <b1ad085a-6fb0-979d-3d7a-01ce52e61e53@netwolves.com>
References: <b1ad085a-6fb0-979d-3d7a-01ce52e61e53@netwolves.com>

On 4/24/20 8:55 AM, Steve Clark wrote:
> Hello,
> 
> I am using psql to copy data extracted from an InfluxDB in csv format 
> into postgresql.
> I have a key field on the time field which I have defined as a bigint 
> since the time I get
> from InfluxDB is an epoch time.
> 
> My question is does psql abort the copy if it hits a duplicate key, or 
> does it keep processing?

Aborts.

\copy uses COPY so:

https://www.postgresql.org/docs/12/sql-copy.html

"COPY stops operation at the first error. This should not lead to 
problems in the event of a COPY TO, but the target table will already 
have received earlier rows in a COPY FROM. These rows will not be 
visible or accessible, but they still occupy disk space. This might 
amount to a considerable amount of wasted disk space if the failure 
happened well into a large copy operation. You might wish to invoke 
VACUUM to recover the wasted space."

> 
> 
> Thanks,
> -- 
> Stephen Clark
> *NetWolves Managed Services, LLC.*
> Sr. Applications Architect
> Phone: 813-579-3200
> Fax: 813-882-0209
> Email: steve.clark@netwolves.com
> http://www.netwolves.com
> 
> Email Confidentiality Notice: The information contained in this 
> transmission may contain privileged and confidential and/or protected 
> health information (PHI) and may be subject to protection under the law, 
> including the Health Insurance Portability and Accountability Act of 
> 1996, as amended (HIPAA). This transmission is intended for the sole use 
> of the individual or entity to whom it is addressed. If you are not the 
> intended recipient, you are notified that any use, dissemination, 
> distribution, printing or copying of this transmission is strictly 
> prohibited and may subject you to criminal or civil penalties. If you 
> have received this transmission in error, please contact the sender 
> immediately and delete this email and any attachments from any computer. 
> Vaso Corporation and its subsidiary companies are not responsible for 
> data leaks that result from email messages received that contain 
> privileged and confidential and/or protected health information (PHI).


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (12+ messages)  latest in thread

Message-ID: <8ae0540e-7068-f296-eddf-3355f8ee8f29@aklaver.com>
Permalink:  ../8ae0540e-7068-f296-eddf-3355f8ee8f29@aklaver.com/
Also on:    postgresql.org/message-id/8ae0540e-7068-f296-eddf-3355f8ee8f29@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, steve.clark@netwolves.com
  Subject: Re: psql \copy
  In-Reply-To: <8ae0540e-7068-f296-eddf-3355f8ee8f29@aklaver.com>
  References: <b1ad085a-6fb0-979d-3d7a-01ce52e61e53@netwolves.com> <8ae0540e-7068-f296-eddf-3355f8ee8f29@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