Re: Dropping all constraints in database

From: Glyn Astill <glynastill(at)yahoo(dot)co(dot)uk>
To: pgsql-admin(at)postgresql(dot)org, Lukasz Brodziak <lukasz(dot)brodziak(at)gmail(dot)com>
Subject: Re: Dropping all constraints in database
Date: 2011-03-14 10:51:38
Message-ID: 810750.89007.qm@web26006.mail.ukl.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin


> From: Lukasz Brodziak <lukasz(dot)brodziak(at)gmail(dot)com>
> Subject: [ADMIN] Dropping all constraints in database
> To: pgsql-admin(at)postgresql(dot)org
> Date: Monday, 14 March, 2011, 9:26
> Hello,
>
> Is there a way of disabling/dropping all constrainsts in a
> given
> database? I need to restore a db which has duplicate values
> in nearly
> half of its tables then remove duplicates and then add the
> constraints
> back. Is there a way to do that for each table in one
> statement/function? It may be even a java/perl script if it
> can do
> such a thing. Thank You all in advance for help.
>
>

Magnus Hagander wrote about a method to do that here:

http://blog.hagander.net/archives/131-Automatically-dropping-and-creating-constraints.html

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Kevin Grittner 2011-03-14 13:58:32 Re: PSQLException: ERROR: could not open relation with OID xxxx
Previous Message Thomas Kellerer 2011-03-14 09:43:09 Re: Dropping all constraints in database