Thread: COPY questions

COPY questions

From
Bill Todd
Date:
If the COPY command fails does it identify the offending row?

After reading the manual and the wiki I assume that there is no way to
tell copy to start with the Nth record in the input file. Is that
correct? It seems like such an obvious feature I was surprised not to
find it. Thanks.

Bill

Re: COPY questions

From
Jeff Davis
Date:
On Wed, 2009-02-18 at 11:56 -0700, Bill Todd wrote:
> If the COPY command fails does it identify the offending row?

Yes, it tries to identify the failing row in the error message.

> After reading the manual and the wiki I assume that there is no way to
> tell copy to start with the Nth record in the input file. Is that
> correct? It seems like such an obvious feature I was surprised not to
> find it. Thanks.

That's correct.

There are a lot of features that people could find useful: various
formats and various manipulations of the data before it's processed. If
all of those features were implemented, COPY would start to look more
like perl.

In general, it's best to preprocess the data yourself and pipe the
result to a "COPY ... FROM STDIN" command. That way you can actually use
perl if you want to.

Regards,
    Jeff Davis


Re: COPY questions

From
Adrian Klaver
Date:
On Wednesday 18 February 2009 10:56:45 am Bill Todd wrote:
> If the COPY command fails does it identify the offending row?
>
> After reading the manual and the wiki I assume that there is no way to
> tell copy to start with the Nth record in the input file. Is that
> correct? It seems like such an obvious feature I was surprised not to
> find it. Thanks.
>
> Bill

Take a look at:
http://pgfoundry.org/projects/pgloader/

It offers what you are looking for.

--
Adrian Klaver
aklaver@comcast.net

Re: COPY questions

From
Bill Todd
Date:
Adrian Klaver wrote:
On Wednesday 18 February 2009 10:56:45 am Bill Todd wrote: 
If the COPY command fails does it identify the offending row?

After reading the manual and the wiki I assume that there is no way to
tell copy to start with the Nth record in the input file. Is that
correct? It seems like such an obvious feature I was surprised not to
find it. Thanks.

Bill   
Take a look at:
http://pgfoundry.org/projects/pgloader/

It offers what you are looking for.
 
Thanks for the suggestion but pgloader appears to be a Linux only solution and my environment is Windows. The other problem is that there is no documentation that I could find (other than a PDF made from slides).

Bill

Re: COPY questions

From
Tony Caduto
Date:
Bill Todd wrote:
> Thanks for the suggestion but pgloader appears to be a Linux only
> solution and my environment is Windows. The other problem is that
> there is no documentation that I could find (other than a PDF made
> from slides).
>
> Bill
Bill,
pgloader is a Python app,  It should work on win32 as well.


Later,

Tony Caduto
AM Software Design
htpp://www.amsoftwaredesign.com
Home of Lightning Admin for PostgreSQL


Re: COPY questions

From
Adrian Klaver
Date:
On Wednesday 18 February 2009 2:00:19 pm Tony Caduto wrote:
> Bill Todd wrote:
> > Thanks for the suggestion but pgloader appears to be a Linux only
> > solution and my environment is Windows. The other problem is that
> > there is no documentation that I could find (other than a PDF made
> > from slides).
> >
> > Bill
>
> Bill,
> pgloader is a Python app,  It should work on win32 as well.
>
>
> Later,
>
> Tony Caduto
> AM Software Design
> htpp://www.amsoftwaredesign.com
> Home of Lightning Admin for PostgreSQL

Documentation:
http://pgloader.projects.postgresql.org/

--
Adrian Klaver
aklaver@comcast.net