pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gary Stainburn <gary.stainburn@ringways.co.uk>
To: Steven Lane <stevelcmc@mindspring.com>
To: pgsql-admin@postgresql.org
Subject: Re: Better copy/import
Date: Mon, 23 Jul 2001 15:09:09 +0100
Message-ID: <01072315090906.27033@gary.ringways.co.uk> (raw)
In-Reply-To: <v03007803b781d5ebe403@[65.15.153.184]>
References: <Pine.LNX.4.33.0107201718230.29652-100000@visor.corp.nextbus.com>
	<v03007803b781d5ebe403@[65.15.153.184]>

Hi Steve,

I don't no of a direct method, e.g. turning off the 'die' behaviour of copy 
etc., but when I had the similar situation, I found it easier to just load 
the file in vi and clean the data first.  Admittedly I only had a couple of 
hundred lines tho'.

Alternatively, you could write a small parser in your favourite language 
(perl).  Just turn on auto-comit, prepare the insert and then execute the 
prepared insert once per line.  Write any line with a bad result to a 
seperate file.  This file, you probably could just vi to update and re-run 
those lines throught the same script.

Gary

On Monday 23 July 2001  2:24 pm, Steven Lane wrote:
> Hello all:
>
> Sorry for the bad subject line on the last version of this post.
>
> I'm trying to load about 10M rows of data into a simple postgres table. The
> data is straightforward and fairly clean, but does have glitches every few
> tens of thousands of rows. My problem is that when COPY hits a bad row it
> just aborts, leaving me to go back, delete or clean up the row and try
> again.
>
> Is there any way to import records that could just skip the bad ones and
> notify me which ones they are? Loading this much data is pretty
> time-consuming, especially when I keep having to repeat it to find each new
> bad row. Is there a better way?
>
> -- sgl
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     



view thread (2+ messages)

Message-ID: <01072315090906.27033@gary.ringways.co.uk>
Permalink:  ../01072315090906.27033@gary.ringways.co.uk/
Also on:    postgresql.org/message-id/01072315090906.27033@gary.ringways.co.uk

 · 

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-admin@postgresql.org
  Cc: gary.stainburn@ringways.co.uk, stevelcmc@mindspring.com
  Subject: Re: Better copy/import
  In-Reply-To: <01072315090906.27033@gary.ringways.co.uk>
  References: <Pine.LNX.4.33.0107201718230.29652-100000@visor.corp.nextbus.com> <v03007803b781d5ebe403@[65.15.153.184]> <01072315090906.27033@gary.ringways.co.uk>

* 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