COPY questions

Started by Bill Toddabout 17 years ago6 messagesgeneral
Jump to latest
#1Bill Todd
pg@dbginc.com

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

#2Jeff Davis
pgsql@j-davis.com
In reply to: Bill Todd (#1)
Re: COPY questions

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

#3Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Bill Todd (#1)
Re: COPY questions

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

#4Bill Todd
pg@dbginc.com
In reply to: Adrian Klaver (#3)
Re: COPY questions

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

#5Tony Caduto
tony_caduto@amsoftwaredesign.com
In reply to: Bill Todd (#4)
Re: COPY questions

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

#6Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Tony Caduto (#5)
Re: COPY questions

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