Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-admin by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group