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

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: I dont get it, dump / restore failures to the same cluster.


  • From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
  • To: Michael Ben-Nes <miki(at)canaan(dot)co(dot)il>
  • Cc: postgresql <pgsql-general(at)postgresql(dot)org>
  • Subject: Re: I dont get it, dump / restore failures to the same cluster.
  • Date: Wed, 24 May 2006 16:28:32 -0400
  • Message-id: <1534(dot)1148502512(at)sss(dot)pgh(dot)pa(dot)us>

Michael Ben-Nes <miki(at)canaan(dot)co(dot)il> writes:
> pg_dump -Fc sourcedb > sourcedb-Fc.dump
> pg_dump -a sourcedb > sourcedb.dump
> createdb test
> pg_restore -c -s -d test sourcedb-Fc.dump
> psql test < sourcedb.dump

Is there a particularly good reason for doing it that way?

> I got few errors ( here are some of them ):
> ERROR:  insert or update on table "logo_product" violates foreign key constraint "logo_product_product_id_fkey"

In general, separate schema and data restore doesn't work in the
presence of foreign keys.  (This is probably impossible for pg_dump
to handle fully, because there could be circular FK dependencies;
so it doesn't even try ATM.)  Do it the easy way and use a combined
schema-plus-data dump/restore.  Or if you've just got to do it that
way, drop the FK constraints, load the data, re-add the constraints.

			regards, tom lane



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group