Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 2E0A32E0064 for ; Thu, 5 Jun 2008 05:56:04 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 08849-06 for ; Thu, 5 Jun 2008 05:55:53 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from pih-relay08.plus.net (pih-relay08.plus.net [212.159.14.134]) by developer.postgresql.org (Postfix) with ESMTP id F403E2E0057 for ; Thu, 5 Jun 2008 05:54:40 -0300 (ADT) Received: from [84.51.143.99] (helo=server3.office.archonet.com) by pih-relay08.plus.net with esmtp (Exim) id 1K4BEy-0005lT-VP; Thu, 05 Jun 2008 09:54:37 +0100 Received: from [192.168.1.36] (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id CD1C7274065; Thu, 5 Jun 2008 09:54:36 +0100 (BST) Message-ID: <4847A9CC.2010406@archonet.com> Date: Thu, 05 Jun 2008 09:54:36 +0100 From: Richard Huxton User-Agent: Thunderbird 2.0.0.14 (X11/20080421) MIME-Version: 1.0 To: Simon Riggs CC: pgsql-hackers Subject: Re: pg_dump restore time and Foreign Keys References: <1212647003.19964.19.camel@ebony.site> In-Reply-To: <1212647003.19964.19.camel@ebony.site> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Plusnet-Relay: 3f9769c91391796d0d4aa260158ffc77 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200806/224 X-Sequence-Number: 119337 Simon Riggs wrote: > > If we had a way of pg_dump passing on the information that the test > already passes, we would be able to skip the checks. > > Proposal: > > * Introduce a new mode for ALTER TABLE ADD FOREIGN KEY [WITHOUT CHECK]; > * Have pg_dump write the new syntax into its dumps, when both the source > and target table are dumped in same I've been known to manually tweak dumps before now. I can see me forgetting this. What about pg_dump writing out a row-count and MD5 of the rows in the COPY (just a textual calculation). Iff the restore checksum matches the dump checksum for both tables then the foreign-keys can be skipped. If the restore checksum doesn't match the dump then it can issue a warning, but continue and run the full fkey check. -- Richard Huxton Archonet Ltd