Received: from localhost (pluto.hub.org [200.46.204.4]) by postgresql.org (Postfix) with ESMTP id E0A349FB1CF for ; Tue, 7 Nov 2006 17:42:41 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.4]) (amavisd-new, port 10024) with ESMTP id 34351-02 for ; Tue, 7 Nov 2006 17:42:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 9D0AD9FA18B for ; Tue, 7 Nov 2006 17:42:37 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id kA7LgZXm013514; Tue, 7 Nov 2006 16:42:35 -0500 (EST) To: "Paolo Negri" cc: pgsql-admin@postgresql.org Subject: Re: pg_dump and foreign keys troubles In-reply-to: References: Comments: In-reply-to "Paolo Negri" message dated "Tue, 07 Nov 2006 17:25:21 +0000" Date: Tue, 07 Nov 2006 16:42:35 -0500 Message-ID: <13513.1162935755@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/59 X-Sequence-Number: 23586 "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. regards, tom lane