Re: pg_dump --data-only problem with PgSQL 8.0

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jani Averbach <jaa(at)jaa(dot)iki(dot)fi>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: pg_dump --data-only problem with PgSQL 8.0
Date: 2005-01-24 18:46:38
Message-ID: 23557.1106592398@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Jani Averbach <jaa(at)jaa(dot)iki(dot)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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2005-01-24 19:13:41 Re: Trouble Escaping Quotes
Previous Message Michael Fuhr 2005-01-24 18:45:23 Re: pg_dump --data-only problem with PgSQL 8.0