Re: Problem with COPY command on pg_dump

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rob Sargent <robjsargent(at)gmail(dot)com>
Cc: Blake McBride <blake(at)mcbride(dot)name>, pgsql-general(at)postgresql(dot)org
Subject: Re: Problem with COPY command on pg_dump
Date: 2017-12-09 16:23:16
Message-ID: 6646.1512836596@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Rob Sargent <robjsargent(at)gmail(dot)com> writes:
>> On Dec 9, 2017, at 8:42 AM, Blake McBride <blake(at)mcbride(dot)name> wrote:
>> I am using pg_dump on version 9.5.10 and trying to import it on version 9.3.20. Many (or all) COPY commands are failing with messages like:
>> psql:16504.db:16874: ERROR: missing data for column "street"
>> CONTEXT: COPY address, line 1: ""

> Is there in fact ‘street’ data in the file? Sounds like you have the wrong number of columns. Do you have your actual dump and restore commands to show here?

While pg_dump certainly does sometimes produce output that doesn't reload
into older servers, we try to minimize such problems --- and in any case,
the actual COPY data shouldn't be a source of issues. I'm suspicious that
the true problem occurred earlier; maybe a table drop/creation failed
and now COPY is trying to load into a pre-existing table that has the
right name and the wrong column list.

I'd counsel looking at the *first* error message and resolving that,
then trying again. Anything later could just be cascaded failures.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Blake McBride 2017-12-09 16:29:08 Re: Problem with COPY command on pg_dump
Previous Message Dale Seaburg 2017-12-09 16:11:42 Windows XP to Win 10 migration issue