Re: how to disable all pkey/fkey constraints globally - Mailing list pgsql-general

From
Subject Re: how to disable all pkey/fkey constraints globally
Date
Msg-id 29F36C7C98AB09499B1A209D48EAA615B7653DBDB1@mail2a.alliedtesting.com
Whole thread Raw
In response to how to disable all pkey/fkey constraints globally  ("J.V." <jvsrvcs@gmail.com>)
Responses Re: how to disable all pkey/fkey constraints globally  (Joe Abbate <jma@freedomcircle.com>)
List pgsql-general
> -----Original Message-----
> From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-
> owner@postgresql.org] On Behalf Of J.V.
> Sent: Tuesday, October 04, 2011 10:00 PM
> To: pgsql-general
> Subject: [GENERAL] how to disable all pkey/fkey constraints globally
>
> Is there a generic way to drop just all primary key and foreign key constraints
> on a given table?
>
> I know how to do given the specific name of the constraint.
>
> same question but one statement that would just disable all primary key and
> foreign key constraints on a given database?
>
> and am assuming the reverse could not be done because would have to re-
> create each one individually?
>
> Maybe I do not want to drop, so is there a way to simply disable all globally
> (not drop) & then enable all globally?
>

You can find all foreign key constraints for a given table, save constraint definitions, drop constraints, and later
re-enablethem. Look into table pg_constraint and function pg_get_constraintdef. 

Dmitry Epstein | Developer

Allied Testing

www.alliedtesting.com
We Deliver Quality.

pgsql-general by date:

Previous
From: pasman pasmański
Date:
Subject: Re: Hash index not being updated
Next
From: khizer
Date:
Subject: Postgresql-8.2 Replication