pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedBetter copy/import
2+ messages / 2 participants
[nested] [flat]
* Better copy/import
@ 2001-07-23 13:24 Steven Lane <stevelcmc@mindspring.com>
0 siblings, 1 reply; 2+ messages in thread
From: Steven Lane @ 2001-07-23 13:24 UTC (permalink / raw)
To: pgsql-admin
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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Better copy/import
@ 2001-07-23 14:09 Gary Stainburn <gary.stainburn@ringways.co.uk>
parent: Steven Lane <stevelcmc@mindspring.com>
0 siblings, 0 replies; 2+ messages in thread
From: Gary Stainburn @ 2001-07-23 14:09 UTC (permalink / raw)
To: Steven Lane <stevelcmc@mindspring.com>; pgsql-admin
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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2001-07-23 14:09 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-07-23 13:24 Better copy/import Steven Lane <stevelcmc@mindspring.com>
2001-07-23 14:09 ` Gary Stainburn <gary.stainburn@ringways.co.uk>
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