* Stephen Frost ([EMAIL PROTECTED]) wrote:
> * Tom Lane ([EMAIL PROTECTED]) wrote:
> > Stephen Frost <[EMAIL PROTECTED]> writes:
> > >   It seems like pg_restore really should be able to handle COPY errors
> > >   correctly by skipping to the end of the COPY data segment when the
> > >   initial COPY command comes back as an error.
> > 
> > Send a patch ;-)
> 
> This is what I get for knowing how to copy & paste C code, eh? ;-)
> 
> Attached is a patch to pg_restore, against HEAD but I think it'd work
> against 8.1 just fine, to better handle it when a COPY command fails
> (for whatever reason) during a DB restore.
[...]
>     Command was:
> 
> COPY bg02_d00 (ogc_fid, wkb_geometry, area, perimeter, bg02_d00_, bg02_d00_i, 
> state, county, tract, blkgroup, name, lsad, ...
> WARNING: errors ignored on restore: 7
> ------------------------

Of course, looking at this again, I'm afraid my COPY-attempt-detection
logic isn't quite enough.  I was hoping it'd be taken care of by
_sendSQLLine, but apparently not.

The line:
if (strncasecmp(qry->data,"COPY ",5) == 0) AH->pgCopyIn = -1;

Needs to be changed to handle whitespace in front of the actual 'COPY',
unless someone else has a better idea.  This should be reasonably
trivial to do though...  If you'd like me to make that change and send
in a new patch, just let me know.

        Thanks,

                Stephen

Attachment: signature.asc
Description: Digital signature

Reply via email to