Re: dumping table contents in a sensible order

From: Chris Withers <chris(at)simplistix(dot)co(dot)uk>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: dumping table contents in a sensible order
Date: 2016-11-16 07:28:15
Message-ID: e2a1a95b-9a29-e491-b9b2-47e66983746d@simplistix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 16/11/2016 01:05, Adrian Klaver wrote:
>> INSERT 0 1
>> ERROR: insert or update on table "table_one" violates foreign key
>> constraint "table_one_parent_id_fkey"
>> DETAIL: Key (parent_id)=(xxx) is not present in table "table_one".
>>
>> So, the problem appears to be that table_one is self-referential by way
>> of a parent_id field.
>>
>> How can I either:
>>
>> - dump the table in an insertable order?
>
> Don't use --inserts, instead let the data be entered via COPY(the
> default) which does it a single transaction.

That fixed it, many thanks.

I guess that'll teach me to use an answer from StackOverflow without
full understanding the details...

Chris

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Charles Clavadetscher 2016-11-16 07:45:41 Re: Request to share information regarding errors
Previous Message Yogesh Sharma 2016-11-16 06:59:21 Re: Request to share information regarding errors