From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jani Averbach <jaa@jaa.iki.fi>
Cc: pgsql-admin@postgresql.org
Subject: Re: pg_dump --data-only problem with PgSQL 8.0
Date: Mon, 24 Jan 2005 13:46:38 -0500
Message-ID: <23557.1106592398@sss.pgh.pa.us> (raw)
In-Reply-To: <20050124181656.GF23224@jaa.iki.fi>
References: <20050124181656.GF23224@jaa.iki.fi>
Jani Averbach <jaa@jaa.iki.fi> writes:
> the following won't work:
> 4) Dump only data from just created 8.0 database:
> pg_dump \
> "--data-only" \
> "--column-inserts" \
> "--use-set-session-authorization" \
> new_db > new_db.data-only.dump
> 5) Re-Create the new_db:
> dropdb new_db; createdb new_db
> CreateDBSchema.sh new_db
> 6) Try to reload data which was dumped from new ver 8.0 database:
> psql new_db < new_db.data-only.dump
> This will fail with lots of these kinds of errors:
> ERROR: insert or update on table "mytable"
> violates foreign key constraint "mytable_myattr_fkey"
Try it with --disable-triggers.
> Or have I found an ordering bug with pg_dump
> when you are doing "--data-only" dumps?
No. pg_dump can't guarantee a safe order for loading data when there
are pre-existing foreign key constraints in place (since the constraints
could be circular, and it wouldn't necessarily know what they are anyway).
So it doesn't try. You have to use --disable-triggers instead.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, jaa@jaa.iki.fi
Subject: Re: pg_dump --data-only problem with PgSQL 8.0
In-Reply-To: <23557.1106592398@sss.pgh.pa.us>
References: <20050124181656.GF23224@jaa.iki.fi> <23557.1106592398@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox