Received: from localhost (uranus.hub.org [200.46.204.60]) by postgresql.org (Postfix) with ESMTP id B0A239FB251 for ; Thu, 9 Nov 2006 06:26:35 -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 17738-02 for ; Thu, 9 Nov 2006 06:26:34 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.173]) by postgresql.org (Postfix) with ESMTP id 09C329FB24B for ; Thu, 9 Nov 2006 06:26:33 -0400 (AST) Received: by ug-out-1314.google.com with SMTP id k3so152717ugf for ; Thu, 09 Nov 2006 02:26:32 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=CsdE/Kdz5GndMU/OAtQXq//zgonEwDFo0JPsjf6OrAXa21HQCJjZfjMmOzuBuS6xpAgw5NMP7dJdVnLmKVIw+ay1LLUoNQQE2kptV3J12Kxq9mwz1v4GYgxIEJZD+bURd1r828Et2OMpHt/ytJGUkaXvVX+lcZL0zh/AO1fMeVU= Received: by 10.78.160.2 with SMTP id i2mr833415hue.1163067991970; Thu, 09 Nov 2006 02:26:31 -0800 (PST) Received: by 10.78.184.19 with HTTP; Thu, 9 Nov 2006 02:26:31 -0800 (PST) Message-ID: Date: Thu, 9 Nov 2006 10:26:31 +0000 From: "Paolo Negri" To: pgsql-admin@postgresql.org Subject: Re: pg_dump and foreign keys troubles In-Reply-To: <20061109071325.GG90133@nasby.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <13513.1162935755@sss.pgh.pa.us> <20061109071325.GG90133@nasby.net> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/91 X-Sequence-Number: 23618 Thank you all but I've fixed the problem doing that 1) retrieved the original schema of the DB as a SQL script. 2) created a new database with just the empty schema 3) pg_restore on the new DB of a 'c' format dump of the production DB with the options --data-only and --disable-triggers thanks Paolo On 09/11/06, Jim C. Nasby wrote: > 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) >