Search Postgresql Archives

Re: how to disable all pkey/fkey constraints globally

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: pgsql-general-owner@xxxxxxxxxxxxxx [mailto:pgsql-general-
> owner@xxxxxxxxxxxxxx] On Behalf Of J.V.
> Sent: Tuesday, October 04, 2011 10:00 PM
> To: pgsql-general
> Subject:  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-enable them. Look into table pg_constraint and function pg_get_constraintdef.

Dmitry Epstein | Developer
 
Allied Testing

www.alliedtesting.com
We Deliver Quality.

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux