Re: Dumping/Restoring with constraints?

From: Terry Lee Tucker <terry(at)chosen-ones(dot)org>
To: "PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Dumping/Restoring with constraints?
Date: 2008-08-27 14:15:00
Message-ID: 200808271015.00589.terry@chosen-ones.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

On Wednesday 27 August 2008 09:36, Phoenix Kiula wrote:
> On Wed, Aug 27, 2008 at 9:29 PM, Terry Lee Tucker <terry(at)chosen-ones(dot)org>
wrote:
> > We have all sorts of constraints and foreign keys and we have never had
> > any problem with pg_restore related to dumping such that foreign keys are
> > satisfied. You must have data already in the database that violates the
> > restraints. You can restore in two phases; that is, by restoring the
> > schema, and then the data using --disable-triggers. I'm assuming you are
> > doing a binary dump. See the man page for pg_restore.
>
> Thanks for this. I don't have any foreign key violations in my
> existing database. I think the violation is happening because upon
> restoring the table that is being populated checks in another table
> that doesn't yet have data.
>
> I am not using pg_restore. I am just using "psql --file=FILENAME"
> syntax. Is that an issue?

The errors you are having, then, must be related to your own trigger code. It
sounds like you will need to prevent those triggers from firing and the only
way I know how to accomplish that is to do a binary dump and then use
pg_restore as I indicated earlier. There is no way to disable triggers in
your method referenced above.
--
Terry Lee Tucker
Turbo's IT Manager
Turbo, division of Ozburn-Hessey Logistics
2251 Jesse Jewell Pkwy NE
Gainesville, GA 30501
Tel: (336) 372-6812 Fax: (336) 372-6812 Cell: (336) 404-6987
terry(at)turbocorp(dot)com
www.turbocorp.com

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Merlin Moncure 2008-08-27 14:18:14 Re: [GENERAL] PITR - base backup question
Previous Message Phoenix Kiula 2008-08-27 14:12:57 Re: Dumping/Restoring with constraints?

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2008-08-27 14:18:14 Re: [GENERAL] PITR - base backup question
Previous Message Phoenix Kiula 2008-08-27 14:12:57 Re: Dumping/Restoring with constraints?