Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id D3C6264FD12 for ; Wed, 27 Aug 2008 10:29:53 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 61599-03 for ; Wed, 27 Aug 2008 10:29:39 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from rhino2.esc1.com (69-77-143-107.dsl.static.skybest.com [69.77.143.107]) by postgresql.org (Postfix) with ESMTP id 7786364FCD4 for ; Wed, 27 Aug 2008 10:29:44 -0300 (ADT) Received: from rhino2.esc1.com (localhost.localdomain [127.0.0.1]) by rhino2.esc1.com (8.13.8/8.13.8) with ESMTP id m7RDTgJJ030715 for ; Wed, 27 Aug 2008 09:29:42 -0400 Received: from localhost (localhost [[UNIX: localhost]]) by rhino2.esc1.com (8.13.8/8.13.8/Submit) id m7RDTgF1030714 for pgsql-general@postgresql.org; Wed, 27 Aug 2008 09:29:42 -0400 X-Authentication-Warning: rhino2.esc1.com: terry set sender to terry@chosen-ones.org using -f From: Terry Lee Tucker Organization: Ozburn-Hessey Logistics To: "PG-General Mailing List" Subject: Re: Dumping/Restoring with constraints? Date: Wed, 27 Aug 2008 09:29:41 -0400 User-Agent: KMail/1.9.4 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200808270929.42049.terry@chosen-ones.org> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200808/938 X-Sequence-Number: 136768 On Wednesday 27 August 2008 09:19, Phoenix Kiula wrote: > Hello. I have a database dump. With data and schema, which includes > all the constraints and rules. But it seems the pg_dumpall command > does not copy data in such a way that foreign keys are satisfied upon > restoring. Because tables are inter-related, importing them keep > giving errors and eventually no data is imported. Neither pg_dumpall > nor pg_restore seems to have a "without constraints" or "delay > constraints check" type command. What am I missing? Thanks for any > advice. 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. HTH -- 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@turbocorp.com www.turbocorp.com