Unix Technical Forum

COPY command and skipping errors

This is a discussion on COPY command and skipping errors within the pgsql Admins forums, part of the PostgreSQL category; --> Is there a way to skip errors during the run of the COPY command (loading data from a file ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Admins

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 05:16 AM
Tomeh, Husam
 
Posts: n/a
Default COPY command and skipping errors


Is there a way to skip errors during the run of the COPY command
(loading data from a file to a table) like what Oracle SQL*Loader has?
The reason I'm asking is that if the extract file from the mainframe has
an invalid character, the COPY terminates and doesn't continue loading
the rest of records.

Thanks,

--
Husam



---------------------------(end of broadcast)---------------------------

TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq <http://www.postgresql.org/docs/faq>


************************************************** ********************
This message contains confidential information intended only for the
use of the addressee(s) named above and may contain information that
is legally privileged. If you are not the addressee, or the person
responsible for delivering it to the addressee, you are hereby
notified that reading, disseminating, distributing or copying this
message is strictly prohibited. If you have received this message by
mistake, please immediately notify us by replying to the message and
delete the original message immediately thereafter.

Thank you. FADLD Tag
************************************************** ********************

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 05:16 AM
Bruce Momjian
 
Posts: n/a
Default Re: COPY command and skipping errors

Tomeh, Husam wrote:
>
> Is there a way to skip errors during the run of the COPY command
> (loading data from a file to a table) like what Oracle SQL*Loader has?
> The reason I'm asking is that if the extract file from the mainframe has
> an invalid character, the COPY terminates and doesn't continue loading
> the rest of records.


No, but it is on the TODO list:

o Allow COPY to report error lines and continue

This requires the use of a savepoint before each COPY line is
processed, with ROLLBACK on COPY failure.


--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-10-2008, 05:16 AM
Alvaro Herrera
 
Posts: n/a
Default Re: COPY command and skipping errors

On Thu, Sep 22, 2005 at 04:41:57PM -0400, Bruce Momjian wrote:
> Tomeh, Husam wrote:
> >
> > Is there a way to skip errors during the run of the COPY command
> > (loading data from a file to a table) like what Oracle SQL*Loader has?
> > The reason I'm asking is that if the extract file from the mainframe has
> > an invalid character, the COPY terminates and doesn't continue loading
> > the rest of records.

>
> No, but it is on the TODO list:


Also, I think PGLoader can do this. It's on pgfoundry.org.

--
Alvaro Herrera Architect, http://www.EnterpriseDB.com
"Tiene valor aquel que admite que es un cobarde" (Fernandel)

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:41 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com