Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id CD17F1337BCE for ; Mon, 14 Mar 2011 07:57:18 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 66338-02 for ; Mon, 14 Mar 2011 10:57:11 +0000 (UTC) X-Greylist: delayed 00:05:31.48555 by SQLgrey-1.7.6 Received: from nm9.bullet.mail.ukl.yahoo.com (nm9.bullet.mail.ukl.yahoo.com [217.146.182.250]) by mail.postgresql.org (Postfix) with SMTP id 026361337B4A for ; Mon, 14 Mar 2011 07:57:10 -0300 (ADT) Received: from [217.146.183.181] by nm9.bullet.mail.ukl.yahoo.com with NNFMP; 14 Mar 2011 10:51:38 -0000 Received: from [217.146.183.43] by tm12.bullet.mail.ukl.yahoo.com with NNFMP; 14 Mar 2011 10:51:38 -0000 Received: from [127.0.0.1] by omp1028.mail.ukl.yahoo.com with NNFMP; 14 Mar 2011 10:51:38 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 948897.17921.bm@omp1028.mail.ukl.yahoo.com Received: (qmail 89361 invoked by uid 60001); 14 Mar 2011 10:51:38 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1300099898; bh=k/CMzDD6Vsa8DL3i+UoDicg8pfKVAU1Slaf0wZESh1k=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=k+bXeJBbEh6bHSU2p3C6eySZ5E+vEMqv46YmU6WKQllm5IVoDHMYpvJrQj529KI/Gizcok5ZNvFt38qOhE5Eymze4T1rEwn2Vp78TtjVnXFMw0sqD9sTUWCYijjB5npuxVPmXMhFcWqFotmUGPSCBeA3WO4qHAUNZhRt5w00dqM= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=wik7DjFuicxeShjAH+qVPBdv4vOsf5XwmZ7av9AIFl4QnCoK2A5FDPEoZjcQVve8f9u46Kj14rdjpWU5tfu0RnJrB/TrRWFrGEmkkrjSnLUgwxEOAJTJjdSBtGU6RC2Lj3m0PMUzUvVclAT6MdM/hMarxWoUnUJnB3vFA5iS2aI=; Message-ID: <810750.89007.qm@web26006.mail.ukl.yahoo.com> X-YMail-OSG: CsUqmGQVM1me182N8WfVIm0imYhCOkuUdVZGC6TFOPWKl8s kIO0pMy5tQ3fgdolgqi9xcMF3nb7p7rL4hnN7MBC8.sm94HrBiXUDwQPxiaH iwVfoHKc4mVZA0D2iGHodeusfsvexwcY2Vev.mCyH1t0tXUr2l4QWJvNxSMw 5zJRnyuee1h8elrdYa3QY5etAnXOD5e1OlMWLpGVDvFWgmOcU0agSRIWp8g_ ZizZQdoUrBVAmy2W657Ta2tx14mSoozkb8S3n04Nn7o2K80s19J_MPHBrNv5 pi5b3vqEAfok6Q4AsQEOnX6iK_0yr62RjBG4F2fCIyO_GzuQ- Received: from [83.100.146.195] by web26006.mail.ukl.yahoo.com via HTTP; Mon, 14 Mar 2011 10:51:38 GMT X-Mailer: YahooMailClassic/11.4.20 YahooMailWebService/0.8.109.295617 Date: Mon, 14 Mar 2011 10:51:38 +0000 (GMT) From: Glyn Astill Subject: Re: Dropping all constraints in database To: pgsql-admin@postgresql.org, Lukasz Brodziak In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.898 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201103/158 X-Sequence-Number: 37030 =0A> From: Lukasz Brodziak =0A> Subject: [ADMIN]= Dropping all constraints in database=0A> To: pgsql-admin@postgresql.org=0A= > Date: Monday, 14 March, 2011, 9:26=0A> Hello,=0A> =0A> Is there a way of = disabling/dropping all constrainsts in a=0A> given=0A> database? I need to = restore a db which has duplicate values=0A> in nearly=0A> half of its table= s then remove duplicates and then add the=0A> constraints=0A> back. Is ther= e a way to do that for each table in one=0A> statement/function? It may be = even a java/perl script if it=0A> can do=0A> such a thing. Thank You all in= advance for help.=0A> =0A> =0A=0AMagnus Hagander wrote about a method to d= o that here:=0A=0Ahttp://blog.hagander.net/archives/131-Automatically-dropp= ing-and-creating-constraints.html=0A=0A=0A