Received: from localhost (uranus.hub.org [200.46.204.60]) by postgresql.org (Postfix) with ESMTP id 56E2F9FB1C2 for ; Thu, 9 Nov 2006 03:13:33 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.60]) (amavisd-new, port 10024) with ESMTP id 82680-04 for ; Thu, 9 Nov 2006 03:13:32 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 818E19FA618 for ; Thu, 9 Nov 2006 03:13:30 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 4897156456; Thu, 9 Nov 2006 01:13:29 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Thu, 9 Nov 2006 01:13:26 -0600 Date: Thu, 9 Nov 2006 01:13:26 -0600 From: "Jim C. Nasby" To: Tom Lane Cc: Paolo Negri , pgsql-admin@postgresql.org Subject: Re: pg_dump and foreign keys troubles Message-ID: <20061109071325.GG90133@nasby.net> References: <13513.1162935755@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <13513.1162935755@sss.pgh.pa.us> X-Operating-System: FreeBSD 6.1-RELEASE-p10 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.13 (2006-08-11) X-Hashcash: 1:20:061109:tgl@sss.pgh.pa.us::29k5abjXPnenNlwE:00000000000000000000 0000000000000000000000001VdU X-Hashcash: 1:20:061109:hungrylist@gmail.com::T0xvNHO+8C9a+gxw:00000000000000000 0000000000000000000000006Nt2 X-Hashcash: 1:20:061109:pgsql-admin@postgresql.org::MpePIejHHXz3M5Mi:00000000000 0000000000000000000000002B1X X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/87 X-Sequence-Number: 23614 On Tue, Nov 07, 2006 at 04:42:35PM -0500, Tom Lane wrote: > "Paolo Negri" writes: > > My problem is that I have to load the dump (from a 7.3) in a brand new > > database (8.1) and then I need to do quite a few changes to the schema > > dropping some old foreign constraint and adding some different ones. > > ... > > How can I tell to pg_dump to dump the schema with foreign keys > > construct instead of creating constraint trigger? > > You can't: the information just isn't there in 7.3. You'll need to look > at the trigger arguments and reconstruct the FKs. > > IIRC the contrib/adddepend script might be able to help you with this. Would a 7.4 or newer pg_dump connecting to a 7.4 database know enough to do this for you? If so, Paolo could restore his dump to a 7.3 install and go from there... -- Jim Nasby jim@nasby.net EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)